Parsing XML With VBScript

Author Message
skmoon

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 3/7/2008
  • Status: offline
Parsing XML With VBScript Friday, March 07, 2008 7:58 AM (permalink)
0
I have googled until I can google no more. I have also searched through this forum and think I'm getting close. I really hope you guys can help me out here.
 
I am trying to send a GET request to another site and use certain values from the returned XML. I would like to assign those values to variables for later processing.
 
I have tried using:
 Server.CreateObject("Msxml2.ServerXMLHTTP")
 objHttp.open "GET", http://example.com, false
 objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
 objHttp.Send
 Response.ContentType = "text/xml"
 Response.Write (objHttp.responseXML.xml)
 

 
This will display the actual XML to the web page. I cannot find any info on how to use the values from that XML. So, I then saved an xml file to my server and tried this I found at DevGuru:
 
 Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
 objXMLDoc.async = False 
 objXMLDoc.load("myxmlfile.xml") 
 
 Set Node = objXMLDoc.documentElement.selectSingleNode("Artist/Name") 'these are the actual nodes in the xml file
 response.write(Node.text)
 

 
The second code block gets me nothing...no errors - just a blank web page.
 
My first question is which direction should I even start? The first code block or the second (assuming I can "GET" the XML data from another server using this method)?
 
Next, is how do I assign the xml values to a variable?
 
Any help would be so much appreciated.
 
#1
    skmoon

    • Total Posts : 6
    • Scores: 0
    • Reward points : 0
    • Joined: 3/7/2008
    • Status: offline
    RE: Parsing XML With VBScript Friday, March 07, 2008 10:10 AM (permalink)
    0
    After browsing around DevGuru some more, I was able to find a link to the following:
    http://www.dotnetindex.com/articles/8053_Simple_XML_RSS_Parser.asp
     
    I decided to give that code a try and lo and behold, I started getting results.
     
    To fine tune the code, I then began using this guide:
    http://www.devguru.com/Technologies/xmldom/quickref/xmldom_index.html
     
    So far so good. I'm far from finished and may need to ask you guys some questions as I progress along.
     
    Hope everyone has a great weekend!
     
    #2
      TNO

      • Total Posts : 2094
      • Scores: 36
      • Reward points : 0
      • Joined: 12/18/2004
      • Location: Earth
      • Status: offline
      RE: Parsing XML With VBScript Friday, March 07, 2008 1:05 PM (permalink)
      0
      Here's an excellent XML tutorial:

      http://msconline.maconstate.edu/tutorials/XML/default.htm
      To iterate is human, to recurse divine. -- L. Peter Deutsch
       
      #3
        dpatchip

        • Total Posts : 1
        • Scores: 0
        • Reward points : 0
        • Joined: 8/4/2010
        • Status: offline
        Re: RE: Parsing XML With VBScript Wednesday, August 04, 2010 12:43 AM (permalink)
        0
        <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <SOAP-ENV:Header>
          <GoldParameters xmlns="http://www.gold-solutions.com/WebServices/">
           <GoldAuthentification>
            <Username>autogb</Username>
            <Password>Z2I=
        </Password>
            <Domain>EVOTI3</Domain>
            <MethodName>GWSArticlesArticleByCollectionGetListCollections</MethodName>
           </GoldAuthentification>
           <GoldContext>
            <Language>GB</Language>
            <Classe>10</Classe>
            <Site>3001</Site>
            <MerchStructID>1</MerchStructID>
            <CommercialNetworkID>1</CommercialNetworkID>
           </GoldContext>
          </GoldParameters>
         </SOAP-ENV:Header>
         <SOAP-ENV:Body>
          <Response_GWSArticlesArticleByCollectionGetListCollections>
           <CollectionListHeaders>
            <groupRecord>
             <collectionCode><![CDATA[CO10]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 10]]></collectionShortDescription>
             <collectionDescription><![CDATA[JEUX OLYMPIQUES]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[CO11]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 11]]></collectionShortDescription>
             <collectionDescription><![CDATA[STREET WEAR]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[CO12]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 12]]></collectionShortDescription>
             <collectionDescription><![CDATA[VETEMENTS VILLE]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL1]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 1]]></collectionShortDescription>
             <collectionDescription><![CDATA[COLLECTION ETE]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL2]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 2]]></collectionShortDescription>
             <collectionDescription><![CDATA[COLLECTION PRINTEMPS]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL3]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 3]]></collectionShortDescription>
             <collectionDescription><![CDATA[COLLECTION AUTONNE]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL4]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 4]]></collectionShortDescription>
             <collectionDescription><![CDATA[COLLECTION HIVER]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL5]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 5]]></collectionShortDescription>
             <collectionDescription><![CDATA[RENTREE SCOLAIRE]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL6]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 6]]></collectionShortDescription>
             <collectionDescription><![CDATA[COLLECTION NOEL]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL7]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 7]]></collectionShortDescription>
             <collectionDescription><![CDATA[ANNIVERSAIRE]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL8]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 8]]></collectionShortDescription>
             <collectionDescription><![CDATA[PRET A PORTER]]></collectionDescription>
            </groupRecord>
            <groupRecord>
             <collectionCode><![CDATA[COL9]]></collectionCode>
             <collectionShortDescription><![CDATA[COL 9]]></collectionShortDescription>
             <collectionDescription><![CDATA[COUPE DU MONDE]]></collectionDescription>
            </groupRecord>
           </CollectionListHeaders>
          </Response_GWSArticlesArticleByCollectionGetListCollections>
         </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>


        i need to retrieve VALUE col 8 through vbscript code

        plz help me out     

         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9