users@jaxb.java.net

Schema Schema

From: Paul Murray <pmurray_at_bigpond.com>
Date: Tue, 1 Jul 2008 13:35:51 +1000

Arrgh!

I tried to use Jaxb to create a binding for schema documents, using
the schema schema at http://www.w3.org/2001/XMLSchema. Turns out jaxb
doesn't like the schema schema.

[ERROR] Element "{http://www.w3.org/2001/XMLSchema}annotation" shows
up in more than one properties.
   line 182 of file:/Users/pmurray/Projects/schemajaxb/XMLSchema.xsd

[ERROR] The following location is relevant to the above error
   line 176 of file:/Users/pmurray/Projects/schemajaxb/XMLSchema.xsd

What do I do about this, when the schema schema itself is ambiguous?
As far as I can make out, the issue is that an annotation element ...
actually ... I am not certain that the schema schema is ambiguous at
all.

A schema consists of a preamble - any number of incude, import,
redefine, or annotation elements.

Then a body. Any number of redefinable, element, attribute, or
notation elements, each separated by any number of annotations.

Annotations appearing between the preamble and the body, by this
syntax, belong to the preamble. Beats me why jaxb has a problem with it.

The offending bit is this:
      <xs:sequence>
       <xs:choice minOccurs="0" maxOccurs="unbounded"> *** THIS IS
LINE 176
        <xs:element ref="xs:include"/>
        <xs:element ref="xs:import"/>
        <xs:element ref="xs:redefine"/>
        <xs:element ref="xs:annotation"/>
       </xs:choice>
       <xs:sequence minOccurs="0" maxOccurs="unbounded"> *** THIS IS
LINE 182
        <xs:group ref="xs:schemaTop"/>
        <xs:element ref="xs:annotation" minOccurs="0"
maxOccurs="unbounded"/>
       </xs:sequence>
      </xs:sequence>

and "schemaTop" is this:

  <xs:group name="schemaTop">
   <xs:annotation>
    <xs:documentation>
    This group is for the
    elements which occur freely at the top level of schemas.
    All of their types are based on the "annotated" type by
extension.</xs:documentation>
   </xs:annotation>
   <xs:choice>
    <xs:group ref="xs:redefinable"/>
    <xs:element ref="xs:element"/>
    <xs:element ref="xs:attribute"/>
    <xs:element ref="xs:notation"/>
   </xs:choice>
  </xs:group>

_______________________
Live every day as if you are dying of a contagious disease that turns
everyone you bite into zombies.