The Create Marshal example illustrates Java-to-schema databinding. It demonstrates marshalling and unmarshalling of JAXB annotated classes and also shows how to enable JAXP 1.3 validation at unmarshal time using a schema file that was generated from the JAXB mapped classes.
The schema file, bc.xsd, was generated with the following commands:
schemagen src/cardfile/*.java cp schema1.xsd bc.xsd |
Note that schema1.xsd, was copied to bc.xsd; schemagen does not allow you to specify a schema name of your choice.
Follow these instructions to build and run the Create Marshal example on your Application Server instance using the NetBeans IDE.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jaxb/.
Select the j2s-create-marshal folder.
Select the Open as Main Project check box.
Click Open Project.
Right-click the j2s-create-marshal project and select Run.
To compile and run the Create Marshal example using Ant, in a terminal window, go to the tut-install/javaeetutorial5/examples/jaxb/j2s-create-marshal/ directory and type the following:
ant runapp |