VB.NET: Searching Through The XML Nodes On Conditional Attribute Value

Searching in the XML file to get a particular node with an attribute of the given value is sometimes quite confusing.

ITPro Today

April 19, 2005

1 Min Read
ITPro Today logo

Searching in the XML file to get a particular node with an attribute of the given value is sometimes quite confusing.

Here is a simple generic function to solve that problem.

It takes the following parameters:

  • xelRootNode: in most cases, I pass the documentElement, but if you want to search inside a particular node, pass that.

  • strAttribName: The name of the attribute to be checked.

  • strAttribValue: The attribute value to be matched.

  • xelResultNode: Byref, to return the node found

  • strSearchNodesBaseName: Optional, if the search is to be done in nodes of any particular name.

Hope this will be useful for generic purposes.

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like