This is how I do things like this:
Dim xd As New XmlDocument()
If xd.DocumentElement IsNot Nothing Then
For Each Elem As XmlElement In xd.DocumentElement.ChildNodes
If Elem.Name = "App" Then
For Each E As XmlElement In Elem.ChildNodes
Select Case E.Name
Open the document. If it has a document element (
, in your example), cycle through its child nodes until you find the one named
. Then cycle through its child nodes and assign values based on the name of the element. After you have handled
, exit the outer loop.
This is a bit wordy, but has the advantage of bypassing all primary nodes not named
, including any comment nodes you may want to add. It also does not depend on
and the other child nodes being in a particular order.
One other issue that might cause problems is that XML is VERY
picky about special characters. My rule is that if a node might have anything other than strictly alphanumeric characters, the data gets wrapped with CDATA. It is possible that the special characters could be causing problems, which is why I generally use
, the Framework's inner workings will determine if CDATA is needed or not and do the translation automatically.
Added: This article
] does a good job of explaining the difference between
, in case you are interested.