xml - how to write xpath expression -
this question has answer here:
- how use , operator in xpath? 2 answers
i have 2 xml documents resembling following:
first:
<root> <recordtype>abcd</recordtype> <field> <value>red</field> <id>1234</field> </field> </root>
second:
<root> <recordtype>efgh</recordtype> <field> <value>red</field> <id>1234</field> </field> </root>
for above xml have xpath expression allowedvalues xpath:recordtype:abcd;efgh expression working fine, below xml
<root> <record isrecord="true"> <field id="220" isrecord="false" value="red" /> <field id="221" isrecord="true" value="small" /> <field id="222" isrecord="true" value="25" /> </record> <record isrecord="true"> <field id="220" value="red" /> <field id="221" value="large" /> <field id="222" value="50" /> </record> </root>
i want xpath if field id=220 , isrecord="false" , value="red".
will following xpath expression fulfill expectations:
/root/record/field[@id='220' , @isrecord='false' , @value='red']
matching result:
<field id="220" isrecord="false" value="red" />
Comments
Post a Comment