| | |
How to Parse XML in ASP?
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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...
my xml looks like this...
and my error is...
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
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...
ASP Syntax (Toggle Plain Text)
' Create new XML reader object Dim xmlDoc Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM") ' Load the specified XML file (returns XML output) xmlDoc.load("http://somesite.com/api/xml?action=login&login=jon@doe.com&password=foobar") ' Parse XML if xmlDoc.parseError.errorcode <> 0 then ' oops error in xml Response.Write("XML Error...<br>") else ' get xml data Response.Write(xmlDoc.documentElement.childNodes(0).attributes.getNamedItem("code").nodeValue) end if
my xml looks like this...
ASP Syntax (Toggle Plain Text)
<?xml version="1.0" encoding="utf-8"?> <results> <status code="value"/> </results>
and my error is...
•
•
•
•
Microsoft VBScript runtime error '800a01a8'
Object required: 'documentElement'
Thanks
I've figured it out and just in case someone else is forced to use ASP to process XML...
The code above WORKS on an XML document on the server, but if you are like me and you're trying to read XML document from a response stream the following code does the trick...
Cheers!
The code above WORKS on an XML document on the server, but if you are like me and you're trying to read XML document from a response stream the following code does the trick...
ASP Syntax (Toggle Plain Text)
set xmlDoc = createObject("MSXML2.DOMDocument") xmlDoc.async = False xmlDoc.setProperty "ServerHTTPRequest", true xmlDoc.load("http://somesite.com/api/xml?action=login&login=jon@doe.com&password=foobar") response.write xmlDoc.selectSingleNode("//results/status").Attributes.GetNamedItem("code").Text
•
•
Join Date: Jun 2007
Posts: 2
Reputation:
Solved Threads: 0
I am having to send a form to a 3rd party server, the server will respond with a XML validation and policy number. I need to then parse this XML response with ASP into my own webpage.
The info you have given so far seems to be what I need but I can't get it to work. Can you give more information on what you did to parse the XML, including ASP and XML code samples?
Much appreciated!!!
The info you have given so far seems to be what I need but I can't get it to work. Can you give more information on what you did to parse the XML, including ASP and XML code samples?
Much appreciated!!!
![]() |
Similar Threads
- Read and parse and xml file from an ftp server (PHP)
- Parse Error Assitance Needed (PHP)
- How to Parse XML file (RSS, Web Services and SOAP)
- How to use xml? (HTML and CSS)
- Parse XML from ASP!!! (ASP)
Other Threads in the ASP Forum
- Previous Thread: looking for a website development project in ASP
- Next Thread: Remove index.asp from Root url
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





