Hi Malachi,
You're seeing name collisions that you can resolve by giving the content
property for your base type a different name. You can do that using the
enclosed external binding file:
xjc -b dynarray.xjb dynarray.xsd
Regards,
--
Ed Mooney |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201 |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive |fruit flies like
781-442-0459 |Burlington, MA 01803 |a banana. Groucho
Malachi de AElfweald wrote:
> I am getting some errors:
>
> Buildfile: build.xml
>
> compile:
> [echo] Compiling the schema...
> [xjc] Compiling file:/E:/java/jwsdp-1.1/jaxb-1.0/tests/dynarray.xsd
> [xjc] [ERROR] A property with the same name "Content" is generated from more than one schema component.
> [xjc] line 55 of dynarray.xsd
>
> [xjc] [ERROR] (Relevant to above error) another one is generated from this schema component.
> [xjc] line 39 of dynarray.xsd
>
> [xjc] [ERROR] A property with the same name "Content" is generated from more than one schema component.
> [xjc] line 55 of dynarray.xsd
>
> [xjc] [ERROR] (Relevant to above error) another one is generated from this schema component.
> [xjc] line 28 of dynarray.xsd
>
> [xjc] [ERROR] A property with the same name "Content" is generated from more than one schema component.
> [xjc] line 55 of dynarray.xsd
>
> [xjc] [ERROR] (Relevant to above error) another one is generated from this schema component.
> [xjc] line 17 of dynarray.xsd
>
>
> BUILD FAILED
> file:E:/java/jwsdp-1.1/jaxb-1.0/tests/build.xml:27: unable to parse the schema. Error messages should have been provided
>
>
>
>
> My schema is:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.temporal-wave.com/spec/dynarray"
> xmlns="http://www.temporal-wave.com/spec/dynarray"
> elementFormDefault="qualified">
>
> <xsd:element name="dynArray" type="dynArrayIntf" />
>
> <xsd:complexType name="dynArrayIntf" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="content">
> <xsd:choice>
> <xsd:element name="attribute" type="attributeIntf" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:choice>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="attributeIntf" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="content">
> <xsd:choice>
> <xsd:element name="value" type="valueIntf" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:choice>
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="valueIntf" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="content">
> <xsd:choice>
> <xsd:element name="subvalue" type="subvalueIntf" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:choice>
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="subvalueIntf" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="content">
> <xsd:attribute name="id" type="xsd:string"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="content" mixed="true">
> <xsd:choice>
> <xsd:element name="text" type="xsd:string" minOccurs="0" maxOccurs="1"/>
> <xsd:element name="hex" type="xsd:hexBinary" minOccurs="0" maxOccurs="1"/>
> <xsd:element name="base64" type="xsd:base64Binary" minOccurs="0" maxOccurs="1"/>
> </xsd:choice>
> </xsd:complexType>
>
> </xsd:schema>
>
>
>
> The schema shows as valid in Architag XRay XML Editor... I assumed JAXB would generate a single class for the "content" complexType, then use it for all of the tags.... what do I need to do to make it work right?
>
> Thanks,
> Malachi
<jaxb:bindings xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
version="1.0">
<jaxb:bindings schemaLocation="dynarray.xsd" node="/xsd:schema">
<jaxb:bindings node="./xsd:complexType[@name='content']">
<jaxb:property name="base"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>