Hey all, I'm having some trouble using the JAXB 2.0 simple binding mode. I
ran across this article:
http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
and it appears to address the very problem I'm having.
I'm using JAXB2_20060508.jar (nightly build)
Here's my schema:
*
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns: xs="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://schematest.foo.com"
xmlns:tns="
http://schematest.foo.com"
elementFormDefault="qualified"
xml:lang="en"
version="1.0"
xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0"
xmlns: xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc">
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings>
<xjc:simple />
</jaxb:globalBindings>
</xs:appinfo>
</xs:annotation>
<xs:element name="user" type="tns:User" />
<xs:complexType name="User">
<xs:sequence>
<xs:element name="address" type="tns:Address" minOccurs="0" />
<xs:element name="age" type="xs:int" />
<xs:element name="firstName" type="xs:string" minOccurs="0" />
<xs:element name="lastName" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:element name="address" type="tns:Address" />
<xs:complexType name="Address">
<xs:sequence>
<xs:element name="addr1" type="xs:string" minOccurs="0" />
<xs:element name="city" type="tns:City" minOccurs="0" />
<xs:element name="state" type="tns:State" minOccurs="0" />
<xs:element name="userCreatedBy" type="tns:User" minOccurs="0" />
<xs:element name="zipCode" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:element name="city" type="tns:City" />
<xs:complexType name="City">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="userCreatedBy" type="tns:User" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:element name="state" type="tns:State" />
<xs:complexType name="State">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="userCreatedBy" type="tns:User" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>
*
As you can see, I'm using the simple binding schema annotation as directed
in the article. Here's the line from my ant build script to run xjc:
*
<xjc extension="true" destdir="gen-src" removeoldoutput="true">
<schema file="simpleBinding.schemlet" />
<schema file="User1.xsd" />
<produces dir="gen-src/com.landacorp.schematest" includes="**/*.java" />
</xjc>
*
Still, I get no @XmlRootElement annotations in the xjc-generated source
files.
Any ideas?
Greg