[xsd-users] Problem with substition groups

FLACHET Nicolas Nicolas.FLACHET at cstb.fr
Tue Nov 28 09:24:36 EST 2017


Hello all,

Sorry to bother you again, but I still have a problem with substitution groups and code generation.

Following the discussions about generated cityGML classes with xsd (version 3.3, as I have a problem with 4.1.0.a11).

I have this kind of simplified  xsd schema (the element witch cause me problem is in bold):

<xs:schema xmlns="http://www.opengis.net/citygml/building/2.0" xmlns:core="http://www.opengis.net/citygml/2.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml"
                targetNamespace="http://www.opengis.net/citygml/building/2.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.0">

                <xs:import namespace="http://www.opengis.net/gml" schemaLocation="../3.1.1/base/gml.xsd"/>
                <xs:import namespace="http://www.opengis.net/citygml/2.0" schemaLocation="cityGMLBase.xsd"/>

                <xs:complexType name="AbstractBuildingType" abstract="true">
                               <xs:complexContent>
                                               <xs:extension base="core:AbstractSiteType">
                                                               <xs:sequence>
                                                                              <xs:element ref="_GenericApplicationPropertyOfAbstractBuilding" minOccurs="0" maxOccurs="unbounded"/>
                                                               </xs:sequence>
                                               </xs:extension>
                               </xs:complexContent>
                </xs:complexType>

                <xs:element name="_GenericApplicationPropertyOfAbstractBuilding" type="xs:anyType" abstract="true"/>

                 <xs:element name="ElementTest" type="gml:CodeType" substitutionGroup="_GenericApplicationPropertyOfAbstractBuilding"/>

</xs:schema>


The parser works fine as a xml reader/writer, however there is no attribute generated with constructor and getter/setter for this element, so if in my code I can't do :
ElementTest anElement = new ElementTest ;


So my question is, is there a way to generate a class ElementTest or does it's impossible du to the xsd file definition ?

Thank in advance to anyone that spend time reading this.

Regards,
Nicolas.


More information about the xsd-users mailing list