I'm searching the java library for parsing XML (complex configuration and data files), I googled a bit but couldn't found other than dom4j (Seems like they are working on V2).. I have taken look at commons configuration but didn't like it, Other apache projects on XML seems under hibernation. I haven't evaluated dom4j by myself but just wanted to know - Does java has other (Good) open source xml parsing libraries? and how's your experience with dom4j?
After the @Voo's answer let me ask another one - Should I use java's built-in classes or any third-party library like dom4j.. What are the advantages?
You don't need an external library for parsing XML in Java. Java has come with built-in implementations for SAX and DOM for ages.
VTD-XML is the heavy duty XML parsing lib... it is better than others in virtually every way... here is a 2013 paper that analyzes all XML processing frameworks available in java platform...
http://sdiwc.us/digitlib/journal_paper.php?paper=00000582.pdf
For folks interested in using JDOM, but afraid that hasn't been updated in a while (especially not leveraging Java generics), there is a fork called CoffeeDOM which exactly addresses these aspects and modernizes the JDOM API, read more here:
http://cdmckay.org/blog/2011/05/20/introducing-coffeedom-a-jdom-fork-for-java-5/
and download it from the project page at:
Nikita's point is an excellent one: don't confuse mature with bad. XML hasn't changed much.
JDOM would be another alternative to DOM4J.
Java supports two methods for XML parsing out of the box.
SAXParser
You can use this parser if you want to parse large XML files and/or don't want to use a lot of memory.
http://download.oracle.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html
Example: http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/
DOMParser
You can use this parser if you need to do XPath queries or need to have the complete DOM available.
http://download.oracle.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilderFactory.html
Example: http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/
If you want a DOM-like API - that is, one where the XML parser turns the document into a tree of Element and Attribute nodes - then there are at least four to choose from: DOM itself, JDOM, DOM4J, and XOM. The only possible reason to use DOM is because it's perceived as a standard and is supplied in the JDK: in all other respects, the others are all superior. My own preference, for its combination of simplicity, power, and performance, is XOM.
And of course, there are other styles of processing: low-level parser interfaces (SAX and StAX), data-object binding interfaces (JAXB), and high-level declarative languages (XSLT, XQuery, XPath). Which is best for you depends on your project requirements and your personal taste.
Source: Stackoverflow.com