Stage 01 · Write · Researched comparison
Best Java XML Libraries for Parsing and Binding in 2026
Jackson dataformat-xml is the first pick for most teams that already use Jackson and want XML mapped to POJOs with the same API as JSON. Pick JAXB when you need a standard, annotation-driven binding layer and can use the Jakarta namespace. Pick Woodstox when raw parse and write throughput matters and you want a fast StAX implementation. All three are open source and free to use.
By Shihab Mia
Published 27 Nov 2026 · 7 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- Jackson dataformat-xml, JAXB, Woodstox, dom4j, XStream and Saxon are all free or open source; Saxon also sells commercial editions.
- The JDK ships DOM, SAX and StAX parsers, so basic parsing needs no extra dependency.
- XStream has a history of published CVEs; check advisories and keep it patched if you use it.
- Saxon-HE is free under its licence; Saxon commercial editions use vendor pricing, so confirm on the Saxonica site.
Who each pick is for
- Teams already using Jackson who want XML bindingJackson dataformat-xml
- Standard annotation-driven XML-to-object bindingJAXB (Jakarta XML Binding, Eclipse implementation)
- Basic parsing with no extra dependenciesJDK DOM, SAX and StAX
- Fast StAX parsing and writingWoodstox
- Tree-based XML editing with a simple APIdom4j
- Quick object serialization to and from XMLXStream
- XSLT, XPath and XQuery processingSaxon
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1Jackson dataformat-xml | Teams already using Jackson who want XML binding | Same ObjectMapper model as JSON | Free (open source) | Free plan |
| 2JAXB (Jakarta XML Binding, Eclipse implementation) | Standard annotation-driven XML-to-object binding | Standard Jakarta API | Free (open source) | Free plan |
| 3JDK DOM, SAX and StAX | Basic parsing with no extra dependencies | Built into the JDK | Free | Free plan |
| 4Woodstox | Fast StAX parsing and writing | High-performance StAX implementation | Free (open source) | Free plan |
| 5dom4j | Tree-based XML editing with a simple API | Easy tree navigation and XPath | Free (open source) | Free plan |
| 6XStream | Quick object serialization to and from XML | Minimal configuration for simple objects | Free (open source) | Free plan |
| 7Saxon | XSLT, XPath and XQuery processing | Strong XSLT 3.0 and XPath support | Free (open source) | Free plan |
How we picked
We picked libraries that genuinely handle XML parsing, binding, streaming or transformation on the JVM and are currently maintained. Criteria were fit for the job, platform support, licence and price, security posture and known limits. Sources are vendor pages, official documentation and project repositories. We did not run benchmarks. Prices and editions change, so confirm details on the vendor or project site before you commit.
The tools, one by one
Jackson dataformat-xml
Best for teams already using Jackson who want XML binding

What it is and where it fits
Jackson dataformat-xml adds XML reading and writing to the Jackson core library. You reuse the same ObjectMapper, annotations and data-binding patterns you use for JSON, which keeps one mental model across formats. It runs on the JVM wherever Jackson runs, including Spring Boot applications. The project is open source under Apache 2.0. It handles namespaces, attributes and mixed content with configuration, but it is not a validating parser and does not replace a schema tool. Teams that need strict schema validation should pair it with a validating parser. Skip it if you want a standards-body binding API rather than a Jackson extension.
Standout: Same ObjectMapper model as JSON
Free (open source), as listed by the vendor (Jackson dataformat-xml website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Same ObjectMapper model as JSON
- supports annotations and tree models
Drawbacks
- Some XML-specific behavior needs extra configuration
- not a full schema validator
Skip it if this limit matters to you: some XML-specific behavior needs extra configuration.
Verdict. A sensible pick for teams already using Jackson who want XML binding.
Alternatives in this guide: JAXB (Jakarta XML Binding, Eclipse implementation), JDK DOM, SAX and StAX, Woodstox
JAXB (Jakarta XML Binding, Eclipse implementation)
Best for standard annotation-driven XML-to-object binding

What it is and where it fits
JAXB is the Jakarta standard for mapping XML to Java objects with annotations. The Eclipse implementation includes the runtime and the XJC tool for generating classes from an XSD. It runs on the JVM and integrates with Jakarta EE and Spring. Since Java 11 the API is no longer part of the JDK, so you add the dependencies explicitly. The namespace change from javax.xml.bind to jakarta.xml.bind means older code needs migration. The project is open source under EPL 2.0 and GPL 2.0. Skip it if you cannot migrate from the javax namespace or if you only need quick ad hoc parsing.
Standout: Standard Jakarta API
Free (open source), as listed by the vendor (JAXB (Jakarta XML Binding, Eclipse implementation) website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Standard Jakarta API
- schema-to-class generation with XJC
Drawbacks
- Namespace moved from javax to jakarta
- not bundled in the JDK since Java 11
Skip it if this limit matters to you: namespace moved from javax to jakarta.
Verdict. A sensible pick for standard annotation-driven XML-to-object binding.
Alternatives in this guide: Jackson dataformat-xml, JDK DOM, SAX and StAX, Woodstox
JDK DOM, SAX and StAX
Best for basic parsing with no extra dependencies

What it is and where it fits
The java.xml module ships DOM, SAX and StAX parsers and writers with every JDK. DOM builds an in-memory tree, SAX is push-based event parsing, and StAX gives pull-based streaming. That covers most parsing and writing needs without adding a dependency. The trade-off is that there is no annotation-based object binding and no schema-to-class generation. DOM memory use grows with document size, so large files suit SAX or StAX. It is free with the JDK. Skip it when you want POJO binding or XSLT beyond the built-in transformer.
Standout: Built into the JDK
Free, as listed by the vendor (JDK DOM, SAX and StAX website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Built into the JDK
- DOM, SAX and StAX cover tree, event and stream models
Drawbacks
- No object binding
- DOM loads the whole document into memory
Skip it if this limit matters to you: no object binding.
Verdict. A sensible pick for basic parsing with no extra dependencies.
Alternatives in this guide: Jackson dataformat-xml, JAXB (Jakarta XML Binding, Eclipse implementation), Woodstox
Woodstox
Best for fast StAX parsing and writing

What it is and where it fits
Woodstox is a StAX parser and writer implementation from the FasterXML project. It focuses on speed and correctness for streaming XML, and it is often the StAX provider underneath other libraries, including Jackson dataformat-xml. It runs on the JVM and is open source under Apache 2.0. Because it is a streaming API, you handle the event loop yourself; it does not map XML to objects. That makes it a good fit for large documents and pipelines where memory matters. Skip it if you want declarative binding, and use a binding library on top instead.
Standout: High-performance StAX implementation
Free (open source), as listed by the vendor (Woodstox website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- High-performance StAX implementation
- used as the default StAX provider in several stacks
Drawbacks
- Lower-level API
- no object binding on its own
Skip it if this limit matters to you: lower-level API.
Verdict. A sensible pick for fast StAX parsing and writing.
Alternatives in this guide: Jackson dataformat-xml, JAXB (Jakarta XML Binding, Eclipse implementation), JDK DOM, SAX and StAX
dom4j
Best for tree-based XML editing with a simple API

What it is and where it fits
dom4j builds an in-memory document tree with an API that many developers find easier than raw DOM. It supports XPath queries and simple modification of nodes. It runs on the JVM and is open source under a BSD-style licence. Because it loads documents into memory, it is not suited to very large files; use a streaming parser for those. The project is mature but moves slowly, so check that it fits your Java version. Skip it for new high-volume streaming work, and prefer it for configuration-style documents you need to read and edit.
Standout: Easy tree navigation and XPath
Free (open source), as listed by the vendor (dom4j website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Easy tree navigation and XPath
- mature and widely used
Drawbacks
- In-memory model
- development pace is slow
Skip it if this limit matters to you: in-memory model.
Verdict. A sensible pick for tree-based XML editing with a simple API.
Alternatives in this guide: Jackson dataformat-xml, JAXB (Jakarta XML Binding, Eclipse implementation), JDK DOM, SAX and StAX
XStream
Best for quick object serialization to and from XML

What it is and where it fits
XStream serializes Java objects to XML and back with little setup. It runs on the JVM and is open source under a BSD-style licence. The main caution is security: XStream has had several published CVEs tied to deserializing untrusted input. Current versions ship a security framework that restricts allowed types, and you should configure it and keep the library patched. Do not deserialize XML from untrusted sources without those restrictions. Skip it for security-sensitive parsing of external data, and prefer a binding library with explicit schema control.
Standout: Minimal configuration for simple objects
Free (open source), as listed by the vendor (XStream website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Minimal configuration for simple objects
- readable XML output
Drawbacks
- History of published CVEs
- permissive default deserialization needs hardening
Skip it if this limit matters to you: history of published CVEs.
Verdict. A sensible pick for quick object serialization to and from XML.
Alternatives in this guide: Jackson dataformat-xml, JAXB (Jakarta XML Binding, Eclipse implementation), JDK DOM, SAX and StAX
Saxon
Best for xSLT, XPath and XQuery processing

What it is and where it fits
Saxon from Saxonica is the reference-grade processor for XSLT, XPath and XQuery on the JVM. Saxon-HE is the free edition and covers XSLT 3.0 and XPath 3.1. Commercial editions add schema-aware processing and other features; check the Saxonica site for current editions and pricing. It is the right tool when transformation logic is central to your pipeline rather than simple parsing. The learning curve is steeper than a binding library, and the free edition has feature limits. Skip it if you only need to read and write XML without transformation.
Standout: Strong XSLT 3.0 and XPath support
Free (open source), as listed by the vendor (Saxon website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Strong XSLT 3.0 and XPath support
- Saxon-HE is free
Drawbacks
- Commercial editions are paid
- larger learning curve
Skip it if this limit matters to you: commercial editions are paid.
Verdict. A sensible pick for XSLT, XPath and XQuery processing.
Alternatives in this guide: Jackson dataformat-xml, JAXB (Jakarta XML Binding, Eclipse implementation), JDK DOM, SAX and StAX
Who should use what
If your service already uses Jackson and you want XML mapped to POJOs with the same API, use Jackson dataformat-xml. If you need a standards-based binding layer with schema-to-class generation, use JAXB and plan the jakarta namespace migration. If you are parsing very large documents and memory matters, use Woodstox or the JDK StAX API directly. If transformation is the core job, use Saxon. For quick object dumps on internal, trusted data, XStream works, but harden its security settings first.
Questions to settle before you buy
What to check before you buy
- Confirm the library supports your Java version and the javax or jakarta namespace you use.
- Check whether you need object binding, streaming, tree editing or XSLT, and pick accordingly.
- Review the security advisories and CVE history, especially for deserialization libraries.
- Confirm the licence fits your distribution, including any commercial edition terms.
- Test with your real documents, including namespaces, attributes and large files.
FAQ
Do I need a library if the JDK already has XML parsers?
No, for basic parsing. The JDK ships DOM, SAX and StAX. Add a library when you want object binding, faster streaming, easier tree editing or XSLT features beyond the built-in transformer.
Is JAXB still part of the JDK?
No. JAXB was removed from the JDK in Java 11. You add the Jakarta XML Binding API and the Eclipse implementation as dependencies, and note the namespace moved from javax to jakarta.
Which library is best for very large XML files?
Use a streaming API. Woodstox or the JDK StAX parser reads events without loading the whole document. DOM-based libraries like dom4j hold the full tree in memory, which does not scale to large files.
Is XStream safe to use?
It can be, with care. XStream has had published CVEs around deserialization. Use a current version, configure its security framework to allow only expected types, and never deserialize untrusted XML without restrictions.
Is Saxon free?
Saxon-HE is the free edition and covers XSLT 3.0 and XPath 3.1. Commercial editions add features such as schema-aware processing. Check the Saxonica site for current editions and pricing.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 27 Nov 2026.