What xml/xslt library(ies) currently work well for java? [closed]

I need to apply some xml templates to various streams of xml data (and files, on occasion) and there seem to be a large number of xml libraries for java out there -- enough that it's difficult to quickly determine which libraries are still active, how they differ from the other options that are also active, and what criteria should be considered when choosing one.

What libraries do you use for manipulating xml in java, and why is it better than the alternatives?

Asked by: Grace705 | Posted: 21-01-2022

Answer 1

saxon is the xslt and xquery parser -- http://saxon.sourceforge.net/. this is built by a known xslt expert(who was on the xslt spec committe and who has authored books). there is an open source version and a commercial version.

It(xslt piece) gets continuously improved .
the other xslt tool in java, is of course, XALAN.

xml -- there are so many. notable(well tested over the years) ones
1) jdk xml parser -- dom, sax, stax
2) xerces : from apache
3) XOM -- if DOM doesn't work for you
4) JDOM -- one of the earlier popular open source tool
5) JAXB -- built into the JDK 6 now
6) woodstox -- nice xml processor(read/write) -- http://woodstox.codehaus.org/

Answered by: Ned781 | Posted: 22-02-2022

Answer 2

You should decide if you want/are able to load the whole document into memory. If it is a large document, you may want to look at the sax parser. This works well for large documents. Otherwise you may want to look into a dom parser.

Answered by: Fenton794 | Posted: 22-02-2022

Answer 3

No one has mentioned JAXP, the Java API for XML Processing. Comes right out of the box with the jdk, with default xml library implementations.

Answered by: Melanie685 | Posted: 22-02-2022

Answer 4

Wrt "JAXP": that's just a very simple wrapper for creating DOM or SAX parser instances. And implementation that JDK bundles is Xerces. So it's not an alternative per se; it's just the standard API to construct "JDK parser" mentioned earlier. For XSLT, Saxon is strictly superior to Xalan; featurewise, speedwise (2x). JAXB v2 good for data binding, Stax (Woodstox) best for streaming.

Answered by: Adelaide911 | Posted: 22-02-2022

Answer 5

I use Xerces for XML parsing (DOM) and validation against XSD.

For XSLT processing I used Xalan but it was 3 years ago so many things must have change, in my memory it was easy to use and powerful (I was using input XML file of several Mo)

Answered by: Alfred492 | Posted: 22-02-2022

Answer 6

I've been using StAX pull parser for implementing custom memory and performance efficient POJO-2-xml serialization solution and was pretty delighted with results. It is bundled in JDK6 so you won't need any additional dependencies to run it.

Answered by: David505 | Posted: 22-02-2022

Similar questions

parsing - Best Java library(ies) for forgiving command interpreter

Closed. This question does not meet Stack Overflow guid...

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)