users@jaxb.java.net

xjc schema compilation error jaxb2 limitation?

From: Zden?k Vr?bl?k <zdenek_at_vrablik.org>
Date: Sun, 3 Jun 2007 23:06:50 +0100

Hi all,

I have compiled xsd schema with jaxb2 (tested versions 2.0.5 and 2.1.3).
Schema is available here: http://schemas.opengis.net/gml/2.1.2/geometry.xsd
Used java: Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)

I got this error:
[ERROR] rcase-RecurseLax.2: There is not a complete functional mapping
between the particles.
  line 263 of file:/home/zzz/projects/projects/wfs/schema/geometry.xsd

[ERROR] derivation-ok-restriction.5.4.2: Error for type
'MultiPointType'. The particle of the type is not a valid restriction
of the particle of the base.
  line 263 of file:/home/zzz/projects/projects/wfs/schema/geometry.xsd
(all errors are attached)

I have compiled it without problems with apache xmlbeans and i think
this schema is correct.

What limitations has JAXB2?

Here is part of geometry.xsd schema file where the error occures:
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
elementFormDefault="qualified" version="2.1.2">
        <annotation>
                <appinfo>geometry.xsd v2.1.2 2002-07</appinfo>
                <documentation xml:lang="en">
      GML Geometry schema. Copyright (c) 2001,2002 OGC, All Rights Reserved.
    </documentation>
        </annotation>
        <!-- bring in the XLink attributes -->
        <import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlinks.xsd"/>

....

(this complex type is ok)
<complexType name="GeometryCollectionType">
                <annotation>
                        <documentation>
        A geometry collection must include one or more geometries, referenced
        through geometryMember elements. User-defined geometry collections
        that accept GML geometry classes as members must instantiate--or
        derive from--this type.
      </documentation>
                </annotation>
                <complexContent>
                        <extension base="gml:AbstractGeometryCollectionBaseType">
                                <sequence>
                                        <element ref="gml:geometryMember" maxOccurs="unbounded"/>
                                </sequence>
                        </extension>
                </complexContent>
        </complexType>
        <complexType name="MultiPointType">
                <annotation>
                        <documentation>
        A MultiPoint is defined by one or more Points, referenced through
        pointMember elements.
      </documentation>
                </annotation>
                <complexContent>
                        <restriction base="gml:GeometryCollectionType">
                                <sequence>
                                        <element ref="gml:pointMember" maxOccurs="unbounded"/>
                                </sequence>
                                <attribute name="gid" type="ID" use="optional"/>
                                <attribute name="srsName" type="anyURI" use="required"/>
                        </restriction>
                </complexContent>
        </complexType>

...

(this complex type is ok)
<complexType name="GeometryCollectionType">
                <annotation>
                        <documentation>
        A geometry collection must include one or more geometries, referenced
        through geometryMember elements. User-defined geometry collections
        that accept GML geometry classes as members must instantiate--or
        derive from--this type.
      </documentation>
                </annotation>
                <complexContent>
                        <extension base="gml:AbstractGeometryCollectionBaseType">
                                <sequence>
                                        <element ref="gml:geometryMember" maxOccurs="unbounded"/>
                                </sequence>
                        </extension>
                </complexContent>
        </complexType>

(this type causes error )
        <complexType name="MultiPointType">
                <annotation>
                        <documentation>
        A MultiPoint is defined by one or more Points, referenced through
        pointMember elements.
      </documentation>
                </annotation>
                <complexContent>
                        <restriction base="gml:GeometryCollectionType">
                                <sequence>
                                        <element ref="gml:pointMember" maxOccurs="unbounded"/>
                                </sequence>
                                <attribute name="gid" type="ID" use="optional"/>
                                <attribute name="srsName" type="anyURI" use="required"/>
                        </restriction>
                </complexContent>
        </complexType>

How could I compile this xsd file with xjc?
Thanks for any idea.

Regards,
Zdenek Vrablik