I'm trying to figure out the best way (considering there could be instances
where I get a lot of data in this XML, and I want to minimize any slowdowns)
to extract the value of one particular node from an XML string (not saved as
a file, but passed as a string from another module).
For example, let's assume I get back XML in a string that looks like this:
<Commands>
<cmd name="1">Value 1</cmd>
<cmd name="2">Value 2</cmd>
<cmd name="3">Value 3</cmd>
</Commands>
I need an efficient way that I can (for example) return the value from the
cmd tag with name attribute "2" (so for this example, to return "Value 2").
What is going to be the best way to do this? It was suggested (here) that I
use the XmlTextReader, but I'm not totally sure how that would work.
Can anyone help?
Ideally I'd like a function (VB.NET) that takes the xml as one parameter (as
a string), and the cmd "name" as another parameter (also as a string), and
returns a string containing the value.
Thanks!
-Scott