xml - How to use XPath contains() here? -
i'm trying larn xpath. looked @ other contains() examples around here, nil uses , operator. can't work:
//ul[@class='featurelist' , contains(li, 'model')]
on:
... <ul class="featurelist"> <li><b>type:</b> clip fan</li><li><b>feature:</b> air moved: 65 ft. amps: 1.1 clip: grips surface 1.63" plug: 3 prong grounded plug on heavy duty model usage: garage, workshop, dorm, work-out room, deck, office & more.</li><li><b>speed setting:</b> 2 speeds</li><li><b>color:</b> black</li><li><b>power consumption:</b> 62 w</li><li><b>height:</b> 14.5"</li><li><b>width:</b> grill diameter: 9.5"</li><li><b>length:</b> 11.5"</li> <li><b>model #: </b>cr1-0081-06</li> <li><b>item #: </b>n82e16896817007</li> <li><b>return policy: </b></li> </ul> ...
you looking @ first li
kid in query have instead of looking li
kid element may contain text, 'model'
. need query following:
//ul[@class='featurelist' , ./li[contains(.,'model')]]
this query give elements have class
of featurelist
1 or more li
children contain text, 'model'
.
xml xpath
No comments:
Post a Comment