-
ASP & XML
Hi!
I have XML coming through a URL. I need to parse that XML.
I am using XMLHTTP (on the server side) to get the data. That piece is working fine.
I need help in parsing the data, which could be through XSLT or DOM or anything. Please help.
Following is my code.
Code:
Response.Buffer = True
Dim objXMLHTTP, xml
' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
' Opens the connection to the remote server.
xml.Open "GET", "http://xyz.com", False
' Actually Sends the request and returns the data:
xml.Send
'Display the HTML both as HTML and as text
Response.Write "<h1>The HTML text</h1><xmp>"
Response.Write xml.responseText
Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"
Response.Write xml.responseText
Set xml = Nothing
Set xmlRoot = xml.documentElement
For Each xmlPNode In xmlRoot.childNodes
xml = xml & _
"<H3>" & xmlPNode.nodeName & "</H3>"
If xmlPNode.childNodes.length = 0 Then
strDoc = strDoc & _
"<I>No data</I>"
Else
strDoc = strDoc & "<TABLE border>"
For Each xmlNode In xmlPNode.childNodes
strDoc = strDoc & "<TR>" & _
"<TD><B>" & xmlNode.nodeName & ":</B></TD>" & _
"<TD>" & xmlNode.text + "</TD>" & _
"</TR>"
Next
End If
strDoc = strDoc & "</TABLE>"
Next
Response.Write strDoc
-
Re: ASP & XML
See my reply in your other thread, try keeping your questions to a single thread so as to avoid anarchy.
-
Re: ASP & XML