background image

Looking at the Conflicts

<< The example.xsd Schema | Using a Binding Declarations File >>
<< The example.xsd Schema | Using a Binding Declarations File >>
F
IX
C
OLLIDES
E
XAMPLE
61
<xs:element name="zip" type="xs:integer"/>
</xs:sequence>
<xs:attribute name="zip" type="xs:string"/>
</xs:complexType>
</xs:schema>
Looking at the Conflicts
The first conflict in
example.xsd
is the declaration of the
element
name
Class
:
<xs:element name="Class" type="xs:int"/>
Class
is a reserved word in Java, and while it is legal in the XML schema lan-
guage, it cannot be used as a name for a schema-derived class generated by
JAXB.
When this schema is run against the JAXB binding compiler with the
ant fail
command, the following error message is returned:
[xjc] [ERROR] Attempt to create a property having the same
name as the reserved word "Class".
[xjc] line 6 of example.xsd
The second conflict is that there are an
element
and a
complexType
that both use
the name
Foobar
:
<xs:element name="FooBar" type="FooBar"/>
<xs:complexType name="FooBar">
In this case, the error messages returned are:
[xjc] [ERROR] A property with the same name "Zip" is
generated from more than one schema component.
[xjc] line 22 of example.xsd
[xjc] [ERROR] (Relevant to above error) another one is
generated from this schema component.
[xjc] line 20 of example.xsd
The third conflict is that there are an
element
and an
attribute
both named
zip
:
<xs:element name="zip" type="xs:integer"/>
<xs:attribute name="zip" type="xs:string"/>