Dim docu As New XmlDocument()
docu.load("C:igfile.xml")
Dim tempNode As XmlNode
tempNode = docu.SelectSingleNode("/header/type")
someArray(someIndex) = tempNode.innerText
...do something more...
I am using XmlDocument() to load a huge XML document (100~300MB)
When I open the document and read it as a string, my application Use about 900MB of RAM.
I want to know why it happens, how can I stop it?
Please note: Even if it is, XmlDocument does not have Dispose() to remove the allocated things.
Although I need to use the entire string of the huge XML file in the second half of the application, but /header/type.innerText is just a word
More sources:
Private Sub setInfo(ByVal notePath As String)
Dim _NOTE As XDocument
_NOTE = XDocument.Load(notePath)
If (From node In _NOTE...Select node).Value = "" Then
lvlist.Items.Add("No Title")
Else
lvlist.Items.Add((From node In _NOTE...Select node).Value)
End If
lvlist.Items(lvlist.Items.Count-1).SubItems.Add((From node In _NOTE...Select node).Count)
< br />
End Sub
It reads the XML document, calculates the tags and retrieves the string value. That’s it.
With these values, _NOTE(XDocument) is useless at that time .
< p>
Represents a reader that provides fast, noncached, forward-only access to XML data.
Dim docu As New XmlDocument()
docu.load("C:igfile.xml")
Dim tempNode As XmlNode
tempNode = docu.SelectSingleNode("/header/type")
someArray(someIndex) = tempNode.innerText
...do something more.. .
I am using XmlDocument() to load a huge XML document (100~300MB)
When I open the document and read it as a string, my application The program uses about 900MB of RAM.
I want to know why it happens, how can I stop it?
Please note: Even if it is, XmlDocument does not have Dispose() to remove the allocated things.
Although I need to use the entire string of the huge XML file in the second half of the application, but /header/type.innerText is just a word
More sources:
Private Sub setInfo(ByVal notePath As String)
Dim _NOTE As XDocument
_NOTE = XDocument.Load(notePath)
If (From node In _NOTE...Select node).Value = "" Then
lvlist.Items.Add("No Title")
Else
lvlist.Items.Add((From node In _NOTE...Select node).Value)
End If
lvlist.Items(lvlist.Items.Count-1).SubItems.Add((From node In _NOTE...Select node).Count)
< br />
End Sub
It reads the XML document, calculates the tags and retrieves the string value. That’s it.
With these values, _NOTE(XDocument) is useless at that time .
XmlReader may solve your needs. From MSDN:
Represents a reader that provides fast, noncached, forward-only access to XML data.