Recently, at work, I had to parse an XML to extract order information, to create a dashboard for a customer PoC. Given my exposure to XMLBeans, it was the most logical place to start. Then I decided to switch over to JDOM.
With XMLBeans, I was not using the XPath syntax, but the Java programming model, where we can access XML elements using Java constructs like array, object methods and the like. It is also possible to access XML data using the cursor syntax and the XPath syntax.
The main reason for switching from XMLBeans to JDOM was the need to create a jar from the XML. In order to use the Java syntax in XMLBeans, we need to generate a jar file from XSD of the XML data. While Java access makes it very easy to work with XML data, it is not possible to extend the model to consider multiple XML files. Incorporating new XMLs whose structure is not known in advance is a challenge.
With JDOM, all I needed (along with the XML data itself) was the XPath of the element whose value is to be extracted and processed. Hence, it is possible to provide that information as part of application input itself. No extra effort is needed.