Access an XML node by value

FaxBuraBrossy

New Member
Is it possible to access an XML section / node using an attribute value (e.g. \[code\]id\[/code\]) using JavaScript?For example:\[code\]<people> <person id='1'> <name>Tom</name> <age>30</age> </person> <person id='2'> <name>Ian</name> <age>22</age> </person> <person id='3'> <name>Ben</name> <age>45</age> </person></people>\[/code\]I want to be able to select a person with a given id. For example, finding the ID 2 would return Ian.This is possible in ActionScript like so:\[code\]xml.people.person.(@id == 2).name\[/code\]Is something similar available in JS?
 
Back
Top