select specific node using xpath
I have a specific node that I want to select using xpath, and it is one of a couple of sibling nodes that has a specific child node... How can I select that using xpath? Here is a mock xml node structure that I wipped up real quick...
<Templates>
<TemplateData>
<Patient>
<dateOfBirth>1990-09-09T04:00:00Z</dateOfBirth>
<gender>F</gender>
<name>
<firstName>Sam</firstName>
<lastName>Hill</lastName>
</name&g开发者_如何学Ct;
<compositeID>
<id>102</id>
<idType>patientID</idType>
</compositeID>
<compositeID>
<id>182</id>
<idType>populationPatientID</idType>
</compositeID>
</Patient>
</TemplateData>
</Templates>
Imagine I wanted just one of the compositeID. One who' IdType was populationPatientID... How would I do that?
I thought I would try /Templates/Patient/compositeID[./idType='populationPatientID']/id
But I am really not sure... I definitely need to learn more xpath.
精彩评论