Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7409493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:05:27+00:00 2026-05-29T06:05:27+00:00

I have following xml: <TextWithNodes><Node id=0 />astralis<Node id=8 /> <Node id=9 />ltd<Node id=12 />

  • 0

I have following xml:

<TextWithNodes><Node id="0" />astralis<Node id="8" /> <Node id="9" />ltd<Node id="12" />
<Node id="14" />{<Node id="15" />DOCUMENT<Node id="23" />}<Node id="24" /> <Node id="25" />{<Node id="26" />TYPE<Node id="30" />}<Node id="31" />EX-<Node id="34" />10<Node id="36" />.<Node id="37" />12<Node id="39" /> <Node id="40" />{<Node id="41" />SEQUENCE<Node id="49" />}<Node id="50" />3<Node id="51" /> <Node id="52" />{<Node id="53" />FILENAME<Node id="61" />}<Node id="62" />e<Node id="63" />300201<Node id="69" />_<Node id="70" />ex<Node id="72" />10<Node id="74" />-<Node id="75" />12<Node id="77" />.<Node id="78" />txt<Node id="81" /> </TextWithNodes>

and I need to pick node from Id 25 to id 75. It is a portion of XML. Original XML is very long.

I am using following code:

Dim reader As XmlTextReader = New XmlTextReader(System.Web.HttpContext.Current.Server.MapPath("~/App_Data/gate_xml_output.xml"))

            reader.WhitespaceHandling = WhitespaceHandling.None

            Dim xmlDoc As XmlDocument = New XmlDocument()
            'Load the file into the XmlDocument
            xmlDoc.Load(reader)
            'Close off the connection to the file.
            reader.Close()

  Dim nodeList As XmlNodeList = xmlDoc.SelectNodes("//TextWithNodes/node()[preceding-sibling::Node[@id=" & startNode & "] and following-sibling::Node[@id=" & endNode & "]]")

            Dim sb As StringBuilder = New StringBuilder

            For Each childNode As XmlNode In nodeList
                If childNode.Value IsNot Nothing Then
                    sb.Append(childNode.Value & " ")
                End If
            Next

            ' read the text between these nodes
            ExtractText = sb.ToString

It is working but It is very slow. Any alternative of getting this data from XML ?

Please suggest.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:05:28+00:00Added an answer on May 29, 2026 at 6:05 am

    Explore Linq to XML; it should be quicker: http://msdn.microsoft.com/en-us/library/bb387098.aspx

    Also good info here: http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx

    There’s ton of info out there.

    Here’s an article about performance comparison with xmldoc and xmlreader: http://www.nearinfinity.com/blogs/joe_ferner/performance_linq_to_sql_vs.html

    and another: http://msdn.microsoft.com/en-us/library/bb387048.aspx

    +1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following xml: <TextWithNodes><Node id=0 />astralis<Node id=8 /> <Node id=9 />ltd<Node id=12 />
I have the following XML document: <projects> <project> <name>Shockwave</name> <language>Ruby</language> <owner>Brian May</owner> <state>New</state> <startDate>31/10/2008
I have a following xml document: <node0> <node1> <node2 a1=x1> ... </node2> <node2 a1=x2>
I have the following XML- <rows> <row id=5> <cell>Item1</cell> <attrs> <attr> <id>1</id> <type>CheckBox</type> <values>
I have the following xml: <?xml version=1.0 encoding=utf-8 ?> <ROLES> <ROLE type=A> <USER name=w
I have a following XML structure that I need to transform: <recordset rowCount=68 fieldNames=ITEM,ECL,LEAD_TIME
I have the following XML: <root> <foo> <bar type=a whole bunch of stuff, then
I have following XML: <Library> <Item> <Field Name=Name>smooth</Field> <Field Name=File Type>mid</Field> <Field Name=File Size>60026</Field>
I have the following XML: <InterSection criteria=Microsoft-ASP>value</Intersection> <InterSection criteria=Microsoft-MVC>value</Intersection> <InterSection criteria=HP-MVC>value</Intersection> I need to
I have the following xml that I need to deserialise to an object: <animals>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.