Java library using css selectors to parse XML

Viewed 3801

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 !

5 Answers

The droidQuery library can do many of the things you are looking for. Although the syntax is a little different, you can:

  • Get view attributes using chained, jQuery-style commands, such as:

    CharSequence text = $.with(this, R.id.myTextView).attr("text");
    
  • Parse XML:

    Document dom = $.parseXML(myXMLString);
    

If you are a fan of jQuery, you will be pleased to see that nearly all of the features it provides are included in droidQuery, and although the syntax may differ at times, its major goal is to be as syntactically close to jQuery as possible.

Related