I have the following XML file:
<?xml version="1.0"?>
<widgets>
<widget id="1">
<name>Oblong Widget</name>
<productNumber>3432341-12312</productNumber>
<cost>45.50</cost>
<description>This widget is useful for jobs requiring
oblong tools.</description>
</widget>
<widget id="2">
<name>Skinny Widget</name>
<productNumber>34323341-1F11</productNumber>
<cost>55.75</cost>
<description>This widget is useful for jobs requiring
skinny tools.</description>
</widget>
</widgets>
And I am using the below bit of ASP to loop and display the data:
<%
Dim objXMLDOM
Set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
'load the widget.xml document
objXMLDOM.load(Server.MapPath("widget.xml"))
Set nodeList = objXMLDOM.documentElement.getElementsByTagName("widget")
For i=0 to nodeList.length-1
Set node = nodeList(i)
For j=0 to node.ChildNodes.length-1
Response.Write nodeList(i).ChildNodes(j).nodeName &" : " & node.ChildNodes(j).Text & "<br>"
Next
Response.Write "<br>------------------------<br><br>"
Next
%>
I am tring to also display the id attribute for each record in the XML file. ie widget id="1" etc.
Any ideas?
Thanks.
<?xml version="1.0"?>
<widgets>
<widget id="1">
<name>Oblong Widget</name>
<productNumber>3432341-12312</productNumber>
<cost>45.50</cost>
<description>This widget is useful for jobs requiring
oblong tools.</description>
</widget>
<widget id="2">
<name>Skinny Widget</name>
<productNumber>34323341-1F11</productNumber>
<cost>55.75</cost>
<description>This widget is useful for jobs requiring
skinny tools.</description>
</widget>
</widgets>
And I am using the below bit of ASP to loop and display the data:
<%
Dim objXMLDOM
Set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
'load the widget.xml document
objXMLDOM.load(Server.MapPath("widget.xml"))
Set nodeList = objXMLDOM.documentElement.getElementsByTagName("widget")
For i=0 to nodeList.length-1
Set node = nodeList(i)
For j=0 to node.ChildNodes.length-1
Response.Write nodeList(i).ChildNodes(j).nodeName &" : " & node.ChildNodes(j).Text & "<br>"
Next
Response.Write "<br>------------------------<br><br>"
Next
%>
I am tring to also display the id attribute for each record in the XML file. ie widget id="1" etc.
Any ideas?
Thanks.