troubleshooting Question

XML Datafile

Avatar of MJRoberts
MJRobertsFlag for Canada asked on
Visual Basic.NET
1 Comment1 Solution280 ViewsLast Modified:
Hello experts,

I have a 30meg+ staic XML datafile. What I need to do is read only one node from that data file into memory. That data node will only at most  2 or 3k in size. I do not have to load any other portion of the XML file into memory other than the found node. What are my fasted (performance) options. The method I was using was loding the entire document into memory before any node searching occured. Yikes, that was slow and really did not find the required node. I was using an XMLDocument like below

      Dim doc As XmlDocument = New XmlDocument
      Dim output As String = ""

         output = doc.SelectSingleNode("//LAYOUT-TYPE[@Name='" & layoutName & "']" & _
                                  "//LAYOUT[@Name='" & layout& "']" & _
                                  "//TABLE[@Name='" & table & "']").OuterXml
      Catch ex As Exception
      End Try

Loading this enitre document into memory is just plain bad idea. It is extremely slow. One need to read this file like and pick the required node. The problem is I am new at XML and don't know how to do this.

Thanks all
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros