JavaTM Architecture for XML Binding
Sample Applications
Specification Version: 0.75
Reference Implementation (RI) Version: Beta
Building and Running the Sample Apps With Ant
In order to run the sample applications using the supplied Ant
build.xml files, simply follow these steps after you've installed
the JAXB Reference Implementation:
For Solaris/Linux:
- % export JAVA_HOME=<your J2SE installation directory>
- % export JAXB_HOME=<your JAXB installation directory>
- % export ANT_HOME=$JAXB_HOME
- % export PATH=$JAXB_HOME/bin:$PATH
- % cd $JAXB_HOME/examples/users-guide/SampleApp1
- % ant -emacs
- repeat for each sample app
For WindowsNT/2000/XP:
- > set JAVA_HOME="<your J2SE installation directory>"
- > set JAXB_HOME="<your JAXB installation directory>"
- > set ANT_HOME=%JAXB_HOME%
- > set PATH=%JAXB_HOME%\bin;%PATH%
- > cd %JAXB_HOME%\examples\users-guide\SampleApp1
- > ant -emacs
- repeat for each sample app
Building and Running the Sample Apps Manually
It is also possible to build each of the sample apps manually rather
than use the supplied Ant build.xml files. For example, to build and
run examples/users-guide/SampleApp1, follow these steps:
For Solaris/Linux:
Note: the specific details for each sample app may differ
- % export JAVA_HOME=<your J2SE installation directory>
- % export JAXB_HOME=<your JAXB installation directory>
- % export JAXB_LIBS=$JAXB_HOME/lib
- % cd $JAXB_HOME/examples/users-guide/SampleApp1
- % $JAXB_HOME/bin/xjc.sh po.xsd -p primer.po
- % export CLASSPATH=$JAXB_LIBS/jaxb-api.jar:$JAXB_LIBS/jaxb-ri.jar:$JAXB_LIBS/jaxb-xjc.jar:
$JAXB_LIBS/jaxb-libs.jar:$JAXB_LIBS/jaxp-api.jar:$JAXB_LIBS/xercesImpl.jar:
$JAXB_LIBS/sax.jar:$JAXB_LIBS/dom.jar:$JAXB_LIBS/jax-qname.jar:.
Be sure to enter the above command on a single line.
- % javac Main.java primer/po/*.java primer/po/impl/*.java
- % java Main
For WindowsNT/2000/XP:
Note: the specific details for each sample app may differ
- > set JAVA_HOME="<your J2SE installation directory>
- > set JAXB_HOME="<your JAXB installation directory>
- > set JAXB_LIBS=%JAXB_HOME%\lib
- > cd %JAXB_HOME%\examples\users-guide\SampleApp1
- > $JAXB_HOME/bin/xjc.sh po.xsd -p primer.po
- > set CLASSPATH="%JAXB_LIBS%/jaxb-api.jar;%JAXB_LIBS%/jaxb-ri.jar;%JAXB_LIBS%/jaxb-xjc.jar;
%JAXB_LIBS%/jaxb-libs.jar;%JAXB_LIBS%/jaxb-api.jar;%JAXB_LIBS%/xercesImpl.jar;
%JAXB_LIBS%/sax.jar;%JAXB_LIBS%/dom.jar;%JAXB_LIBS%/jax-qname.jar;.
Be sure to enter the above command on a single line.
- > javac Main.java primer\po\*.java primer\po\impl\*.java
- > java Main
- repeat for each sample app
List of Sample Apps
- examples/users-guide/SampleApp1
- This sample application demonstrates how to unmarshal an instance
document into a Java content tree and access data contained within
it.
-
- examples/users-guide/SampleApp2
- This sample application demonstrates how to modify a java content
tree and marshal it back to a xml data.
-
- examples/users-guide/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
-
- examples/users-guide/SampleApp4
- This sample application demonstrates how to enable validation during
the unmarshal operations.
-
- examples/users-guide/SampleApp5
- This sample application demonstrates how to validate a Java content
tree at runtime.
-
- examples/users-guide/SampleApp6
- This sample application demonstrates how to customize the default
binding produced by xjc.
-
- examples/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.
-
- examples/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.
-