MJRoberts
asked on
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.HttpCo ntext.Curr ent.Server .MapPath(C onfigurati onSettings .AppSettin gs("Layout -FileName" )))
output = doc.SelectSingleNode("//LA YOUT-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
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.HttpCo
output = doc.SelectSingleNode("//LA
"//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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.