Mike_Stevens
asked on
Determine if XML node exists using VB.NET
I have an existing XML file that i need to write values to. How can I determine if a specific node already exists in the file? If the node does not exist how can i create just one specific node with affecting the entire xml document?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If (yourNode.Attributes.Count
For atrib As Integer = 0 To yourNode.Attributes.Count
If (yourNode.Attributes(atrib
'found it
x = yourNode.Attributes.GetNam
'or x = yourNode.Attributes(atrib)
Exit For ' to exit this for if only needed to find this one attribute
End If
Next
End If
Answer from expert tpwells found at https://www.experts-exchange.com/questions/22068480/VB-net-XML-node-check-attribute-exists.html