Generate an XML Document from an Object Model with JAXB 2 Learn how to get an XML document from your Java object model using JAXB 2. With annotations, you can also customize the document and use adapters to format data. ava offers various ways to manipulate XML, including the following: Use simple file I/O or javax.xml.stream.XmlStreamWriter. Use XML serialization with java.beans.XMLEncoder, which