Selecting element nodes from a xmlDataDocument using the childNodes
collection or by using selectSingleNode and then reading innerXml or outerXml
leaks cpu-resources.
A trivial example showing this behaviour is included below.
Running this example increases the cpu-load gradually and reaches 100%
within a minute or two.
The problem exists with innerXml as well as outerXml operations.
Using a xmlDocument instead of a xmlDataDocument does not show this behaviour.
Imports System.Xml
Public Class Form1
Inherits System.Windows.Forms.Form
Private xmlData As New XmlDataDocument
Private WithEvents timer As New Windows.Forms.Timer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
xmlData.LoadXml("<root><element/></root>")
timer.Interval = 250
timer.Start()
End Sub
Private Sub timer_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles timer.Tick
Dim y As String
For i As Integer = 1 To 150 'Actual loop count may be adjusted to
your computer
y = xmlData.DocumentElement.ChildNodes(0).OuterXml
Next
End Sub
End Class
Regards
Henrik