Marshalling an XML document
Marshalling is the construction of an XML document from a Java representation of the document, from the equivalent Java model. In this section, we shall marshal an XML document. The XML document that will be marshalled is listed as follows:
<?xml version="1.0" encoding = 'UTF-8'?> <catalog title="Oracle Magazine" publisher="Oracle Publishing"> <journal date="September-October 2008"> <article section="FEATURES"> <title>Share 2.0</title> <author>Alan Joch</author> </article> </journal> <journal date="March-April 2008"> <article section="ORACLE DEVELOPER"> <title>Declarative Data Filtering</title> <author>Steve Muench</author> </article> </journal> </catalog>
We need to create a Java application to marshal an XML document. Select the project node in the Application Navigator and select File|New. In the New Gallery window select Categories|General and...