Parsing XML in ASP classic
Of all the blog post titles I'd like to write, "Parsing XML in ASP classic" is definitely not at the top of my list. But sometimes you just have to suck it up. So here we go...
Given a string that contains XML (maybe the result of an Ajax request or the contents of some config file), let's get some values out of it.
Here's some sample XML that I'll be using:
Create a MSXML2.DOMDocument.6.0 object. Use its LoadXML method. You can then use the selectSingleNode and XPath to get values out. For instance, if I wanted the value for ShoeSize in the above XML, I could use an XPath of //@ShoeSize to get a node. Then use the text property of that node to get the value.
There ya go. If you aren't an XPath whiz, you can use this XPath tester to help you through it.