To run the sample applications using the supplied Ant build.xml files, follow these steps:
For Solaris/Linux:
- % <your JWSDP1.3 installation directory>/apache-ant/bin/ant -emacs
- repeat for each sample app
For WindowsNT/2000/XP:
- > <your JWSDP1.3 installation directory>\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.
Many of the sample applications have been given more descriptive names in this release.
- samples/bind-choice (formerly part of SampleApp9)
- This sample application illustrates how a choice model group is bound to a Java interface by the <jaxb:globalBindings bindingStyle="modelGroupBinding"/> customization.
- samples/catalog-resolver
- This example demonstrates how to use the new "-catalog" compiler switch for resolving external entity references.
- samples/create-marshal (formerly SampleApp3)
- This sample application demonstrates how to use the ObjectFactory class to create a Java content tree from scratch and marshal it to XML data. It also demonstrates how to add content to a JAXB List property.
- samples/datatypeconverter (formerly SampleApp7)
- This sample application is very similar to the inline-customize sample application (formerly SampleApp6), but illustrates an easier, but not as robust, <jaxb:javaType> customization.
- samples/external-customize (formerly SampleApp8)
- 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 (formerly part of SampleApp9)
- 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 (formerly SampleApp6)
- This sample application demonstrates how to customize the default binding produced by the XJC binding compiler.
- samples/modify-marshal (formerly SampleApp2)
- This sample application demonstrates how to modify a java content tree and marshal it back to XML data.
- 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/ondemand-validate (formerly SampleApp5)
- This sample application demonstrates how to validate a Java content tree at runtime.
- 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 can be used with JAXB to increase the flexibility of processing.
- samples/subgroup-extend
- This example shows how the use of the jxb:implClass customization and substitution groups can be used to inject virtual functions into the derived Java hierarchy. It compares two equivalent ways of achieving the same processing, but one is much simpler than the other (search for the "enlightened" boolean flag in the code).
- samples/ubl
- This sample application processes a UBL order instance and writes a report to the screen.
- samples/unmarshal-read (formerly SampleApp1)
- This sample application demonstrates how to unmarshal an instance document into a Java content tree and access data contained within it.
- samples/unmarshal-validate (formerly SampleApp4)
- 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/locator-support
- This sample shows how to use the new non-standard locator support. By following the instructions in the readme.txt file, you can cause all of the generated impl classes to implement a new interface that provides more information about error locations. When a ValidationEvent happens on your content tree, simply retrieve the object and cast it down to com.sun.xml.bind.extra.Locatable.
- samples/relaxng
- This example shows how you can use experimental RELAX NG support.
- samples/synchronized-methods
- This sample shows how to use the new non-standard synchronized method support. By following the instructions in the readme.txt, you can cause all of the generated impl class methods signatures to contain the "synchronized" keyword.
- samples/type-substitution
- This sample app demonstrates type substitution using the W3C XML Schema Part 0: Primer international purchase order schema.
- samples/vendor-extensions
- This example demonstrates how to use the <jxb:serializable> and <jxb:superClass> vendor extensions provided by Sun's JAXB RI.