tags:

views:

44

answers:

1

Hi stackoverflowers... What XPath Query will get me the role id of the role that has a subelement with a name element "Participant"... i.e. the answer i want is 11. How do i get that answer using XPath on this XML?

<?xml version="1.0" ?> <qdbapi> <action>API_GetRoleInfo</action> <errcode>0</errcode> <errtext>No error</errtext> <roles> <role id="10"> <name>Viewer</name> <access id="3">Basic Access</access> </role> <role id="11"> <name>Participant</name> <access id="3">Basic Access</access> </role> <role id="12"> <name>Administrator</name> <access id="1">Administrator</access> </role> </roles> </qdbapi>

+3  A: 

Try this:

//role[name = 'Participant']/@id
Rubens Farias