JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
JAXB Wizard and Code-Seeder Palette User's Guide     Java CAPS Documentation
search filter icon
search icon

Document Information

Using the JAXB Wizard and Code-Seeder Palette

Performing a Typical JAXB Binding Process

To Perform a Typical JAXB Binding Process

The JAXB Wizard

Code-Seeder Palette (JAXB) Wizard Editor Palette Actions

Constructs JAXB Object

Marshal JAXB Object

Unmarshal JAXB Object

Performing a Typical JAXB Binding Process

The JAXB APIs and tools are shipped in the taxi subdirectory of the Java WISED. This directory contains sample applications, a JAXB binding compiler (SC), and implementations of the runtime binding framework APIs contained in the javax.xml.bind package. For more information on binding between XML Schema and Java Classes, refer to the following tutorial: http://download.oracle.com/javaee/5/tutorial/doc/bnazf.html.

To Perform a Typical JAXB Binding Process

The following steps demonstrate ONE particular way to bind XML schemas and Java representations. Depending on your requirements, the binding process can be achieved in several different ways.

  1. Generate JAXB classes.

    An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema.

  2. Compile JAXB classes.

    All of the generated classes, source files, and application code must be compiled.

  3. Unmarshal XML documents.

    XML documents written according to the constraints in the source schema are unmarshalled by the JAXB binding framework.


    Note - JAXB also supports the unmarshalling of XML data from sources other than files/documents, such as DOM nodes, string buffers, and SAX Sources.


  4. Generate the content tree.

    The unmarshalling process generates a content tree of data objects instantiated from the generated JAXB classes; this content tree represents the structure and content of the source XML documents.

  5. Validate source XML (optional).

    The unmarshalling process optionally involves validation of the source XML documents before generating the content tree.


    Note - If you modify the content tree in Step 6 (below), you can also use the JAXB Validate operation to validate the changes before marshalling the content back to an XML document.


  6. Process content.

    The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler.

  7. Marshal the content tree out to one or more XML output documents.

    The content may be validated before marshalling.

    To summarize, using JAXB involves two discrete sets of activities:

    • Generate and compile JAXB classes from a source schema, and build an application that implements these classes

    • Run the application to unmarshal, process, validate, and marshal XML content through the JAXB binding framework

    These two steps are usually performed at separate times in two distinct phases. Typically, there is an application development phase in which JAXB classes are generated and compiled, with a binding implementation being built. That is followed by a deployment phase in which the generated JAXB classes are used to process XML content in an ongoing live production setting.