Java Reference
In-Depth Information
> >xjc -verbose -d work/gen src/xml/ch02/Suits.xsd
The final argument specifies the directory where XJC should find your files. With this usage,
XJC will run against all schemas found in the specified directory. You should see output like
this:
parsing a schema...
compiling a schema...
[INFO] generating code
com\soacookbook\ns\suits\ObjectFactory.java
com\soacookbook\ns\suits\Suit.java
>
The ObjectFactory is present for backward compatibility with JAXB 1.0. For the current
example, it will be empty because you are generating an enum type. The resulting class looks
like Example 2-10 .
Example2-10.JAXB 2.1 generated Suit.java enum
package com.soacookbook.ns.suits;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Suit.
*
* <p>The following schema fragment specifies the expected content
contained within
this class.
* <p>
* <pre>
* &lt;simpleType name="Suit">
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
* &lt;enumeration value="SPADES"/>
* &lt;enumeration value="HEARTS"/>
* &lt;enumeration value="DIAMONDS"/>
* &lt;enumeration value="CLUBS"/>
* &lt;/restriction>
* &lt;/simpleType>
* </pre>
*
*/
@XmlType(name = "Suit", namespace = "http://ns.soacookbook.com/suits")
@XmlEnum
Search WWH ::




Custom Search