When I want to find elements from XML in with jQuery, i can just use CSS selectors. Is there any similar selector system for XML parsing in Java?
The query syntax for XML is called XPath.
I am currently creating a sort of "jQuery port to Java". It is called jOOX and will provide most of jQuery's DOM navigation and manipulation methods. In addition to a simple selector expression language, standard XPath and XML transformation is supported, based on the standard Java DOM API
https://github.com/jOOQ/jOOX
Some sample code:
// Find the order at index for and add an element "paid"
$(document).find("orders").children().eq(4)
.append("<paid>true</paid>");
// Find those orders that are paid and flag them as "settled"
$(document).find("orders").children().find("paid")
.after("<settled>true</settled>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With