← Prev in month ← Prev in thread

Modular schemas.

From
Olivier Rossel <>
To
Date
2010-01-11T14:38:05Z
ID
<>
Thread
Modular schemas.
I wish I could create a modular schema, where I can override some
definitions in future versions
of the schema.
At the moment, I plan to use substitutionGroup, but I am still unsure
of the original schema
to define.

Here is for example the schema for a <optionalAttribute> element:

   <xs:element name="optionalAttribute" type="optionalAttribute_type">
   </xs:element>

  <xs:complexType name="optionalAttribute_type" mixed="true">
     <xs:group ref="optionalAttribute_elements"/>
     <xs:attributeGroup ref="optionalAttribute_attributes"/>
   </xs:complexType>

   <xs:attributeGroup name="optionalAttribute_attributes">
   </xs:attributeGroup>

   <xs:group name="optionalAttribute_elements">
   </xs:group>

This schema is pretty much hollow. No specified attribute, no specified inner
content (except textual content, via the mixed="true")

I hope such a schema to validate this XML with no problem:

<optionalAttribute
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Issue1.xsd" >
text
</optionalAttribute>


Unfortunately, this schema is invalid : It is illegal to create an
empty "optionalAttribute_elements" group.
What is the correct way to define a group that contains nothing? or just text?

Note: Please keep in mind that this schema is engineered that way so
future versions of the schema can heavily refactor the groups, via
xsd:substitutionGroup).
← Prev in month ← Prev in thread