Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java library using css selectors to parse XML

Is there a jQuery like JAVA/Android library that uses CSS Selectors to parse the XML ?

Like :

String desc = myXML.find("bloc[type=pro]").get(0).attr("description");

Chainability is also what I'm looking for, in the same way of jQuery...

I hope this exists !

like image 706
ChristopheCVB Avatar asked Aug 03 '11 07:08

ChristopheCVB


1 Answers

I use XPath to solve that issue. XML parsing like JDOM is ok to to the XPath. Maybe jQuery see how XPath works :p

//bloc[@type="pro"][1]/@description

Xpath index start from 1, not 0

https://www.w3schools.com/xml/xpath_syntax.asp

like image 107
Jef Avatar answered Oct 10 '22 23:10

Jef