Skip Navigation Links | |
Exit Print View | |
JAXB Wizard and Code-Seeder Palette User's Guide Java CAPS Documentation |
Using the JAXB Wizard and Code-Seeder Palette
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.
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.
An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema.
All of the generated classes, source files, and application code must be compiled.
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.
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.
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.
The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler.
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.