XML Datafile

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 = ""

      Try
         doc.Load(System.Web.HttpContext.Current.Server.MapPath(ConfigurationSettings.AppSettings("Layout-FileName")))
         output = doc.SelectSingleNode("//LAYOUT-TYPE[@Name='" & layoutName & "']" & _
                                  "//LAYOUT[@Name='" & layout& "']" & _
                                  "//TABLE[@Name='" & table & "']").OuterXml
      Catch ex As Exception
         Debug.WriteLine(ex)
      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
Mark
MJRobertsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YZlatCommented:
you cannot access a single node without loading the whole XML file into XmlDocument

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.