Anyone have any examples of parsing xml with vbscript? I have a .NET generic list serialized into XML that I'm sending to a classic asp page. I thought I'd be able to use XMLDom, but the libraries don't seem to be installed on the server, so I'm looking for another solution. (Was getting "Object Required: documentElement" error)
Basically I'm passing a list of around 15 objects in the form of an xml string that contains a headline and a main article section, and I want to loop through the list and print out both.
This was what I had before I found out XMLDom wasn't installed:
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(item)
Set objFirstChild = xmlDoc.documentElement.firstChild
Set objAttributes = objFirstChild.attributes
For Each Attr in objAttributes
Response.write(Attr.Headline & "<br>")
Response.write(Attr.Content & "<br>")
Next
Response.End
Any help appreciated - my VBScript is pretty rusty these days!
EDIT - Tried as well with MSXML2.DOMDocument but ended up with a Object Required error.
UPDATE - Sample XML included at request of @ulluoink:
<?xml version="1.0" encoding="utf-8"?>
<articles>
<article>
<newsID>7</newsID>
<headline>This is headline 1</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
<article>
<newsID>7</newsID>
<headline>This is headline 2</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
<article>
<newsID>7</newsID>
<headline>This is headline 3</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
</articles>
Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.3.0"). Please specify exact string number, where error raised. If it's a not string, withServer.CreateObject, try checkxmlDoc.parseErrorproperty and watch on returned object.