Test Schema->Java

Compile the generated code with your application code. You need jaxb-api.jar, jsr173_api.jar, and jaxb-impl.jar in your classpath to do so.

Run your application. You need the same 3 jars to run your application.

Test Java->Schema

Until we write more documentations, you'll have to learn this by example. First, try compiling several schemas and see the generated code. You'll notice that there are several annotations that are very commonly used (such as XmlElement, XmlAttribute, and XmlRootElement. Try imitating the use of annotations on your class.

To create a JAXBContext from your annotated class, do JAXBContext.newInstance(MyClass1.class,MyClass2,...). You only need to list classes that are mapped to the root element.

More documents coming soon...

Ask Questions and Tell Us How You Think

Please subscribe to users@jaxb.dev.java.net from here, and send us your comments/questions/bugs/feedbacks. We are listening!