Note that there are some explanatory texts on larger screens.

plurals
  1. POparsing xml with vbscript
    primarykey
    data
    text
    <p>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)</p> <p>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.</p> <p>This was what I had before I found out XMLDom wasn't installed:</p> <pre><code>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 &amp; "&lt;br&gt;") Response.write(Attr.Content &amp; "&lt;br&gt;") Next Response.End </code></pre> <p>Any help appreciated - my VBScript is pretty rusty these days! </p> <p><strong>EDIT</strong> - Tried as well with <code>MSXML2.DOMDocument</code> but ended up with a Object Required error.</p> <p>UPDATE - Sample XML included at request of @ulluoink:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;articles&gt; &lt;article&gt; &lt;newsID&gt;7&lt;/newsID&gt; &lt;headline&gt;This is headline 1&lt;/headline&gt; &lt;content&gt;&lt;![CDATA[&lt;p&gt;This is the start of the main content of the article&lt;/p&gt;&lt;p&gt;This is the next paragraph.&lt;/p&gt; ]]&gt;&lt;/content&gt; &lt;date&gt;04/06/2013 00:00&lt;/date&gt; &lt;/article&gt; &lt;article&gt; &lt;newsID&gt;7&lt;/newsID&gt; &lt;headline&gt;This is headline 2&lt;/headline&gt; &lt;content&gt;&lt;![CDATA[&lt;p&gt;This is the start of the main content of the article&lt;/p&gt;&lt;p&gt;This is the next paragraph.&lt;/p&gt; ]]&gt;&lt;/content&gt; &lt;date&gt;04/06/2013 00:00&lt;/date&gt; &lt;/article&gt; &lt;article&gt; &lt;newsID&gt;7&lt;/newsID&gt; &lt;headline&gt;This is headline 3&lt;/headline&gt; &lt;content&gt;&lt;![CDATA[&lt;p&gt;This is the start of the main content of the article&lt;/p&gt;&lt;p&gt;This is the next paragraph.&lt;/p&gt; ]]&gt;&lt;/content&gt; &lt;date&gt;04/06/2013 00:00&lt;/date&gt; &lt;/article&gt; &lt;/articles&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload