05-24-2011, 12:16 PM
I got the code for retriving node values but i was not able to find the code for retriving attribute value.
i want to get the value of attribute "ref" in the below xml:
---------------------------------------------
VBScript:
i want to get the value of attribute "ref" in the below xml:
---------------------------------------------
Code:
<States>
<State ref="FL">
<name>Florida</name>
<capital>Tallahassee</capital>
</State>
<State ref="IA">
<name>Iowa</name>
<capital>Des Moines</capital>
</State>
</States>
VBScript:
Code:
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("states.xml")
Dim objChildNodes, strNode
Set objChildNodes = objXMLDoc.documentElement.childNodes<State>
For Each strNode In objChildNodes
document.write(strNode.nodeName & "<br>")
Next