Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML get node name and node value

Status
Not open for further replies.

fostom

Programmer
Jul 3, 2002
31
NO
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. Anyone know how this is done. I have tried *everything*.. :( and desperately needs help..

Regards,

Tommy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top