- From: Andrew S Halper <ashalper@usgs.gov>
- Date: Wed, 21 Mar 2007 17:22:12 -0700
- To: xmlschema-dev@w3.org
Would anyone know of a tricky way to declare a substitution group within a complexType? Here is what I'm trying to do: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:doc="http://wwwnwis.er.usgs.gov/XML/doc" xmlns:nx=" http://wwwnwis.er.usgs.gov/XML" xmlns:UML="org.omg.xmi.namespace.UML" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified " id="Country-1.0.c"> <xsd:include schemaLocation="Area.xsd"/> <xsd:include schemaLocation="PrincipalAdministrativeDivision.xsd "/> <xsd:complexType name="CountryType" abstract="false"> <xsd:annotation> <xsd:documentation source=" http://www.itl.nist.gov/fipspubs/fip10-4.htm">Country. A political entity as defined by FIPS 10-4.</xsd:documentation> </xsd:annotation> <xsd:complexContent> <xsd:extension base="AreaType"> <xsd:sequence> <xsd:element name="Code" type=" xsd:token"/> <xsd:element name="Name" type=" xsd:token"/> <xsd:element name=" PrincipalAdministrativeDivision" substitutionGroup=" principalAdministrativeDivision" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="State" substitutionGroup="principalAdministrativeDivision" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> Semantically, what I'm trying to do here is declare State a subtype of PrincipalAdministrativeDivision, and either element is valid at this point in the sequence. I know how to declare a substitutionGroup outside a type, however, CountryType is part of a larger, much more complex schema, and I'm not sure I can rework the element declarations that reference CountryType. Thank you, Andy
Received on Thursday, 22 March 2007 18:55:11 UTC