Converting Objects to XML Format

There are several methods for creating an XML document. One of the simplest methods is to write a program to create a string with the XML tags and corresponding content for the document. While effective and efficient, this approach has its limitations. One notable limitation is that it would require each XML document to be created and coded separately so you would need to write a method or an application for each XML document.

Another limitation is the potential for error should the developer make a coding error, which would lead to mismatched tags and the creation of a document that is not well-formed. This limitation could be overcome by creating a generic object-to-XML method to create XML documents from any ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.