The Marshal palette icon action generates template code to marshal a JAXB object. This provides the ability to convert a Java object tree back into XML data. There is no difference between marshalling a content tree that is created manually using the factory methods and marshalling a content tree that is the result of an unmarshal operation. Clients can marshal a Java content tree back to XML data to a java.io.OutputStream or a java.io.Writer. You must know the Class name of the object you are trying to marshal. You can search for the class using the Find button. The template code can be generated to marshal a JAXB object to a String, OutputStream, File, Writer, or byte array.
The Code-Seeder currently generates code using a single package name in the context path. You may want to edit the code if more than one package name is needed in the context path.
To marshal an existing JAXB class object, drag and drop the JAXB Marshal palette icon to IDE editor.
The Generate JAXB Marshal codedialog box is displayed.
Enter the JAXB object's class name or use the Find... button to search for the class. (as in the Construct's Figure 3section)
Select the Marshal To option. You can generate the code from a marshal JAXB object to one of String, Writer, OutputStream, JMSTextMessage, or File.
The desired method will be generated (as shown below).