-
1
- #1
Hi!
I have trouble getting the correct data parsing my xml. This is my code:
Dim szUrl, nodelist
szUrl = "Set oHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
Set oXml = Server.CreateObject("Msxml2.DomDocument")
oHttp.open "GET",szUrl,False
oHttp.send
oXml.async = False
oXml.resolveExternals = False
oXml.validateOnParse = False
oXml.setProperty "SelectionLanguage", "XPath"
oXml.load oHttp.responseBody
Set node = oXml.selectSingleNode("//*")
Set objNodeList = oXml.getElementsByTagName("OBJECT")
FOR i = 0 To (objNodeList.length -1)
ORDERNO = oXml.getElementsByTagName("ORDERNO").item(i).text
response.write("ORDERNO: " & ORDERNO & "<br>")
STRAD = oXml.getElementsByTagName("STREETADDRESS").item(i).text
response.write("STREETADDRESS: " & STRAD & "<br>")
NEXT
.............
A small part of the input xml from the webservice looks like this:
<ESTATE.FORSALE>
<HEAD>
<PARTNER>carlb</PARTNER>
</HEAD>
<OBJECT>
<OBJECT_HEAD>
<ORDERNO>9000101</ORDERNO>
<OBJECT_LOCATION>
<STREETADDRESS>Chr. Michelsensgate 21</STREETADDRESS>
</OBJECT_LOCATION>
</OBJECT_HEAD>
.............
..this will get me my data, but not dynamically. I want it to print the tagName and the node value dynamically. I dont want to print in every node name statically and then get the node value. Anyone know how this is done. I have tried *everything*.. and desperately needs help..
Regards,
Tommy
I have trouble getting the correct data parsing my xml. This is my code:
Dim szUrl, nodelist
szUrl = "Set oHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
Set oXml = Server.CreateObject("Msxml2.DomDocument")
oHttp.open "GET",szUrl,False
oHttp.send
oXml.async = False
oXml.resolveExternals = False
oXml.validateOnParse = False
oXml.setProperty "SelectionLanguage", "XPath"
oXml.load oHttp.responseBody
Set node = oXml.selectSingleNode("//*")
Set objNodeList = oXml.getElementsByTagName("OBJECT")
FOR i = 0 To (objNodeList.length -1)
ORDERNO = oXml.getElementsByTagName("ORDERNO").item(i).text
response.write("ORDERNO: " & ORDERNO & "<br>")
STRAD = oXml.getElementsByTagName("STREETADDRESS").item(i).text
response.write("STREETADDRESS: " & STRAD & "<br>")
NEXT
.............
A small part of the input xml from the webservice looks like this:
<ESTATE.FORSALE>
<HEAD>
<PARTNER>carlb</PARTNER>
</HEAD>
<OBJECT>
<OBJECT_HEAD>
<ORDERNO>9000101</ORDERNO>
<OBJECT_LOCATION>
<STREETADDRESS>Chr. Michelsensgate 21</STREETADDRESS>
</OBJECT_LOCATION>
</OBJECT_HEAD>
.............
..this will get me my data, but not dynamically. I want it to print the tagName and the node value dynamically. I dont want to print in every node name statically and then get the node value. Anyone know how this is done. I have tried *everything*.. and desperately needs help..
Regards,
Tommy