nsindexpath - Xpath, How to select elements with a specific attribute? -
i learning xpath , trying data html using xpath.
how select elements "a number" c contain c1>1 , price<20
i want select elements:
<a number=1234 date=05-25-2007> <a number=1235 date=05-26-2007> <a number=1237 date=05-25-2007> <a> <a number="1234" date="05-25-2007"> <b> <b1>judith miller</b1> <tax n="yes" rate="21"/> </b> <c> <c1 x="xxxxx" price="20"/> <c1 x="yyyyy" price="15"/> </c> </a> <a number="1235" date="05-26-2007"> <b> <b1>herbert marshall</b1> <adress street="saint marc 2250" city="oslo"/> <tax n="yes" rate="21"/> </b> <c> <c1 x="yyyy" price="25"/> <c1 x="zzzz" price="12"/> <c1 x="xxxx" price="22"/> </c> </a> <a number="1236" date="05-26-2007"> <b> <nazwa>judith miller</nazwa> <adress street="kennedy 511" city="florida"/> <tax n="yes" rate="21"/> </b> <c> <c1 x="fffff" price="15"/> </c> </a> <a number="1237" date="05-25-2007"> <b> <b1>harrison faber</b1> <adress street="street 326" city="london"/> <tax n="no" rate="0"/> </b> <c> <c1 x="xxx" price="20"/> <c1 x="yyy" price="9"/> </c> </a> </a>
after fixing data well-formed , uniform, able 3 a's with
//a[count(c/c1) > 1][c/c1/@price < 20]
fixed data:
<root> <a number="1234" date="05-25-2007"> <b> <b1>judith miller</b1> <tax due="yes" rate="21"/> </b> <c> <c1 x="xxxxx" price="20"/> <c1 x="yyyyy" price="15"/> </c> </a> <a number="1235" date="05-26-2007"> <b> <b1>herbert marshall</b1> <adress street="saint marc 2250" city="oslo"/> <tax due="yes" rate="21"/> </b> <c> <c1 x="yyyy" price="25"/> <c1 x="zzzz" price="12"/> <c1 x="xxxx" price="22"/> </c> </a> <a number="1236" date="05-26-2007"> <b> <b1>judith miller</b1> <adress street="kennedy 511" city="florida"/> <tax due="yes" rate="21"/> </b> <c> <c1 x="fffff" price="15"/> </c> </a> <a number="1237" date="05-25-2007"> <b> <b1>harrison faber</b1> <adress street="street 326" city="london"/> <tax due="no" rate="0"/> </b> <c> <c1 x="xxx" price="20"/> <c1 x="yyy" price="9"/> </c> </a> </root>
Comments
Post a Comment