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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft.XMLDOM 1

Status
Not open for further replies.

nickdel

Programmer
May 11, 2006
367
GB
How do I retrieve the attributes of an element?

i.e.

<ParEle>
<values id="child1">1</values>
<values id="child2">2</values>
</ParEle>

obviously in this case I'm looking for the "id" of each element but lets say I didn't know what the attribute was called, can I just enumerate through all available?

Thanks

Nick
 
This approach may be, on the balance, easier to understand.
[tt]
'object oxmldoc loaded with the document without error
set celem=oxmldoc.getElementsByTagName("values")
for i=0 to celem.length-1
for j=0 to celem(i).attributes.length-1
response.write "(" & i & "," & j & ") " & celem(i).attributes(j).nodeName & ":" & celem(i).attributes(j).nodeValue & "<br />"
next
next
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top