If you’re working with Spring, check out "REST With Spring":

>> CHECK OUT THE COURSE

1. Overview

This is a guide to working with XML in Java.

We’ll go over the most common Java XML processing libraries – for both parsing and binding.

2. DOM Parsers

Simply put, a DOM parser works on the entire XML document, loads it into memory and constructs a tree representation of the document.

Useful Resources

3. SAX Parser

A SAX parser is an event-based parser – it parses the XML document using callbacks without loading the whole document into memory.

Useful Resources

4. StAX Parser

A StAX Parser is median between DOM and SAX parser.

Useful Resources

5. JAXB

JAXB – Java Architecture for XML Binding – is used to convert objects from/to XML.

JAXB is a part of the Java SE platform and one of the APIs in Java EE.

Useful Resources

6. XStream

XStream is a simple library to serialize objects to/from XML.

Here’s the maven dependency to use to get it into a Maven enabled project:

<dependency>
    <groupId>com.thoughtworks.xstream</groupId>
    <artifactId>xstream</artifactId>
    <version>1.4.8</version>
</dependency>

Useful Resources

7. Jackson XML

Jackson XML is an extension of Jackson JSON processor for reading and writing XML encoded data.

In order to use it – here’s the simple Maven dependency you’ll need:

<dependency>
    <groupId>com.fasterxml.jackson.dataformat</groupId>
    <artifactId>jackson-dataformat-xml</artifactId>
    <version>${jackson.version}</version>
</dependency>

Note: Latest version of jackson-dataformat-xml right now is 2.6.3.

Useful Resources

8. Simple XML

Simple XML is a high performance XML serialization framework for Java.

In order to use it you need the following dependency:

<dependency>
    <groupId>org.simpleframework</groupId>
    <artifactId>simple-xml</artifactId>
    <version>${simple-xml.version}</version>
</dependency>

Note: Latest version of Simple XML right now is 2.7.1.

Useful Resources

9. Conclusion

This was a quick intro to the XML ecosystem in Java. Use this as a guide to learn more about doing XML work and getting a high level view of the Java XML landscape.

The new Certification Class of "REST With Spring" is finally out:

>> CHECK OUT THE COURSE