View Single Post
Join Date: Jun 2005
Posts: 54
Reputation: senexom is an unknown quantity at this point 
Solved Threads: 0
senexom's Avatar
senexom senexom is offline Offline
Junior Poster in Training

How to Parse XML in ASP?

 
0
  #1
Aug 8th, 2005
Hey guys,
I'm having a "great" pleasure of parsing XML in my ASP page, except I can't seem to figure it out what I'm doing wrong. I have tried a bunch of stuff and can't seem to read a simple xml doc. here is what my code looks like...
  1. ' Create new XML reader object
  2. Dim xmlDoc
  3. Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
  4.  
  5. ' Load the specified XML file (returns XML output)
  6. xmlDoc.load("http://somesite.com/api/xml?action=login&login=jon@doe.com&password=foobar")
  7.  
  8. ' Parse XML
  9. if xmlDoc.parseError.errorcode <> 0 then
  10. ' oops error in xml
  11. Response.Write("XML Error...<br>")
  12. else
  13. ' get xml data
  14. Response.Write(xmlDoc.documentElement.childNodes(0).attributes.getNamedItem("code").nodeValue)
  15. end if

my xml looks like this...
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <results>
  3. <status code="value"/>
  4. </results>

and my error is...
Microsoft VBScript runtime error '800a01a8'

Object required: 'documentElement'
This is my first time working with XML in ASP, so it is possible i'm missing something simple, any ideas what's going wrong here?

Thanks
Reply With Quote