Schema-2-Java is the process of compiling one or more schema files into generated Java classes. Here are some of the basic steps for developing an app:
Java-2-Schema is the process of augmenting existing Java classes with the annotations defined in the javax.xml.bind.annotation package so that the JAXB runtime binding framework is capable of performing the un/marshal operations. Here are the basic steps for developing an app:
For more information about this process, see the the Java WSDP Tutorial and the extensive sample application documentation.
To run the sample applications using the supplied Ant build.xml files, follow these steps:
For Solaris/Linux:
- % <jwsdp.home>/apache-ant/bin/ant -emacs
- repeat for each sample app
For WindowsNT/2000/XP:
- > <jwsdp.home>\apache-ant\bin\ant -emacs
- repeat for each sample app
A few sample applications do not use Ant. For those samples, refer to the included readme.txt files for instructions.
- samples/datatypeconverter
- This sample application is very similar to the inline-customize sample application, but illustrates an easier, but not as robust, <jaxb:javaType> customization.
- samples/external-customize
- This sample application is identical to the datatypeconverter sample application (formerly SampleApp7) except that the binding customizations are contained in an external binding file.
- samples/fix-collides
- Another binding customization example that illustrates how to resolve name conflicts. Run "ant fail" first to see the compiler output and then look at binding.xjb to see how the errors were resolved. Running "ant" will use the binding customizations to resolve the name conflicts while compiling the schema.
- samples/inline-customize
- This sample application demonstrates how to customize the default binding produced by the XJC binding compiler.
- samples/j2s-create-marshal
- This example illustrates java to schema databinding. It demonstrates marshalling and unmarshalling of JAXB annotated classes. Additionally, it demonstrates how to enable JAXP 1.3 validation at unmarshal time using a schema file generated from the JAXB mapped classes.
- samples/modify-marshal
- This sample application demonstrates how to modify a java content tree and marshal it back to XML data.
- samples/partial-unmarshalling
- In this example, the input document will be unmarshalled a small chunk at a time, instead of unmarshalling the whole document at once.
- samples/pull-parser
- This sample app demonstrates how a pull-parser (SJSXP) can be used with JAXB to increase the flexibility of processing.
- samples/ubl
- This sample application processes a UBL order instance and writes a report to the screen.
- samples/unmarshal-read
- This sample application demonstrates how to unmarshal an instance document into a Java content tree and access data contained within it.
- samples/unmarshal-validate
- This sample application demonstrates how to enable validation during the unmarshal operations.
- samples/xml-channel
- This example demonstrates how to use one communication channel (such as a socket) to send multiple XML messages, and how that channel can be combined with JAXB.
- samples/xml-stylesheet
- This example demonstrates how the behavior of the marshalling process can be customized. In this example, an <?xml-stylesheet ... ?> processing instruction is inserted into the marshalled document.
Sample applications that illustrate JAXB RI vendor extensions.
- samples/character-escape
- This example shows how you can use the new JAXB RI Marshaller property "com.sun.xml.bind.characterEscapeHandler" to change the default character escaping behavior.
- samples/dtd
- This sample application illustrate some of the DTD support available in the JAXB RI's extension mode. Please refer to the Vendor Extensions page for more detail.
- samples/element-substitution
- This sample application illustrates how W3C XML Schema substitution groups are supported in JAXB RI's extension mode. Please refer to the Vendor Extensions page for more detail.
- samples/namespace-prefix
- This sample application demonstrates how to use the new JAXB RI Marshaller property "com.sun.xml.bind.namespacePrefixMapper" to customize the namespace prefixes generated during marshalling.
- samples/type-substitution
- This sample app demonstrates type substitution using the W3C XML Schema Part 0: Primer international purchase order schema.