Is jQuery a selector for parsing Java XML?

When I want to find elements from XML in jQuery, I can just use the CSS selector. Is there a similar selector system for parsing XML in Java?

+7
java jquery xml parsing
source share
3 answers

The query syntax for XML is called XPath.

+4
source share

I am currently creating a kind of "jQuery port for Java". It is called jOOX and will provide most of the navigation and jQuery DOM manipulation methods. In addition to the simple choice expression language, standard XPath and XML conversion based on the standard Java DOM API is supported.

https://github.com/jOOQ/jOOX

Code example:

// 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>"); 
+2
source share

You can use E4X or XPath to request your XML file. I would recommend using the new E4X technology as it is easier to use than XPath.

jQuery offers only standard hierarchical functions for parsing XML files ( see here ), since this is not its purpose to do otherwise.

+1
source share

All Articles