Dim docu As New XmlDocument()
docu.load("C:\bigfile.xml")
Dim tempNode As XmlNode
tempNode = docu.SelectSingleNode("/header/type")
someArray(someIndex) = tempNode.innerText
...do something more...
I use XmlDocument()to download a huge document XML(100 ~ 300 MB)
When I open a document and read it as string, my application uses about 900 MB of RAM. I wonder why this is happening and how I can prevent it?
Please note that: does XmlDocumentn’t even have Dispose()to delete selected items. Although I need a whole line of huge XML file in the later part of the application, /header/type.innerTextthis is just one word
More source:
Private Sub setInfo(ByVal notePath As String)
Dim _NOTE As XDocument
_NOTE = XDocument.Load(notePath)
If (From node In _NOTE...<title> Select node).Value = "" Then
lvlist.Items.Add("No Title")
Else
lvlist.Items.Add((From node In _NOTE...<title> Select node).Value)
End If
lvlist.Items(lvlist.Items.Count - 1).SubItems.Add((From node In _NOTE...<group> Select node).Count)
End Sub
It reads an XML document, counts tags, and retrieves a string value. All this. After these values, _NOTE (XDocument) is useless at this time.