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!

New to XML - how to extract a specific element - please help

Status
Not open for further replies.

gia999

Programmer
Mar 26, 2008
14
GB
Hi guys,

I have the following XML structure :

<Categories>
<Category ID="430009746">Crime</Category>
<Category ID="430010217">Headline Channel</Category>
</Categories>

I can extract the "Crime", "Headline Channel" via :

Set NodeList = ANArticleNode.selectNodes("Categories/Category")
For Each Node In NodeList
response.Write(Node.text)
Next

I just don't know at all how I extract the value of the "ID" in the Category tag?

So basically the "430009746", "430010217" values.

I would so appreciate your help on this - thank you in advance :)

Gia
 
For instance:
[tt] if (Node.attributes.getNamedItem("ID")) is nothing then
response.write "no attribute ID defined" & "<br />"
else
response.write Node.attributes.getNamedItem("ID").nodevalue & "<br />"
end if[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top