Reputation: 411
<ArrayOfContacts xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="someschema">
<Contact>
<ID />
<First_Name />
<Last_Name />
<TelephoneNumbers>
<TelephoneNumber>
<Number />
<IsHome />
<IsWork />
<IsCell />
<ReachableAfterHrs />
</TelephoneNumber>
</TelephoneNumbers>
</Contact>
<Contact>
<ID />
<First_Name />
<Last_Name />
<TelephoneNumbers>
<TelephoneNumber>
<Number />
<IsHome />
<IsWork />
<IsCell />
<ReachableAfterHrs />
</TelephoneNumber>
</TelephoneNumbers>
</Contact>
</ArrayOfContacts>
Looked at this article. Looking for a good way to go over the entire xml and change all node values that need to be changed, this would be dynamically chosen and then to save the document
My recursive routine is similar to this
however when it encounters <TelephoneNumbers>
it does not go down deeper to get the individual elements.
My fn to recurse thru the XMl
Protected Sub RecurseXML(nodes As XmlNodeList)
For Each node As XmlNode In nodes
If (node.ChildNodes.Count > 1) Then
RecurseXML(node.ChildNodes)
Else
node.InnerText = ChangeNodeValue()
End If
Next
End Sub
Basically, trying to read entire XML and change certain vlues[node names not known] and then save the update document.
Upvotes: 1
Views: 6476
Reputation: 43023
Your code doesn't go into <TelephoneNumbers>
because of line
If (node.ChildNodes.Count > 1) Then
There's only one child element here so it stops at that level.
Upvotes: 1