Hi,
I want to create an overlay to existing schema through extensions of particular elements and using substitutiongroup - however, rather than the normal behaviour of supplementing the existing construct, I want the extended element to completely override the substituted group (so the other construct is no longer valid in an instance document).
Actually, I don't really care so much about it invalidating the instance document usage of the head element, I am more interested in the design time implications - using XMLSpy I don't want to see two options for the same construct (the head and the members/substitution extensions), instead I want the extension to take precedence.
There are quite a few files and they're long schema's, so I won't post them all here to save you scrolling, but essentially there are a set of base schemas which must not be modified in anyway (OAGIS BOD's), and then our specific overlays created separately within our own namespace, and assigning a specific namespace to the imported schema's. There are multiple levels of included and imported schema's which build upon each other (e.g. fields, components, Nouns, BOD's etc).
at the moment, the overlay schema imports the standard schema and essentially adds a new construct to it to create a new version (with the same name, different namespace) as the replaced construct, using the <xs:extension> type and substitutiongroup the same as the base type. When including this schema in the top level schema and adding the new construct the design view shows the substition 'chain', which really isn't the desired affect - this could become a very messy view of the schema making it much harder for the designers and developers to use.
I've looked at final and block, but they're more about preventing substitution, rather than overriding base types.
I even tried defining the base type as abstract (however this isn't really an option as it requires modifying the standard schema's which would break compatibility), this didn't seem to have the expected affect so I'm not sure if I've just misunderstood this attribute, or if I'm not using correctly... either way, I would prefer not to use this, as it breaks compatibility.
Here is the extended bit:
So... is it possible using XSD to force the overriding of a substitued construct, or is this impossible ? Or, is there at least a way to make the IDE (XMLSpy) enforce this behaviour ?
Any thoughts would be much appreciated. Thanks,
Damian
A smile is worth a thousand kind words. So smile, it's easy!
I want to create an overlay to existing schema through extensions of particular elements and using substitutiongroup - however, rather than the normal behaviour of supplementing the existing construct, I want the extended element to completely override the substituted group (so the other construct is no longer valid in an instance document).
Actually, I don't really care so much about it invalidating the instance document usage of the head element, I am more interested in the design time implications - using XMLSpy I don't want to see two options for the same construct (the head and the members/substitution extensions), instead I want the extension to take precedence.
There are quite a few files and they're long schema's, so I won't post them all here to save you scrolling, but essentially there are a set of base schemas which must not be modified in anyway (OAGIS BOD's), and then our specific overlays created separately within our own namespace, and assigning a specific namespace to the imported schema's. There are multiple levels of included and imported schema's which build upon each other (e.g. fields, components, Nouns, BOD's etc).
at the moment, the overlay schema imports the standard schema and essentially adds a new construct to it to create a new version (with the same name, different namespace) as the replaced construct, using the <xs:extension> type and substitutiongroup the same as the base type. When including this schema in the top level schema and adding the new construct the design view shows the substition 'chain', which really isn't the desired affect - this could become a very messy view of the schema making it much harder for the designers and developers to use.
I've looked at final and block, but they're more about preventing substitution, rather than overriding base types.
I even tried defining the base type as abstract (however this isn't really an option as it requires modifying the standard schema's which would break compatibility), this didn't seem to have the expected affect so I'm not sure if I've just misunderstood this attribute, or if I'm not using correctly... either way, I would prefer not to use this, as it breaks compatibility.
Here is the extended bit:
Code:
<xs:import namespace="[URL unfurl="true"]http://www.openapplications.org/oagis/9"[/URL] schemaLocation="../../../../oagis/Resources/Nouns/ItemMaster.xsd"/>
<xs:include schemaLocation="../Components.xsd"/>
<xs:complexType name="ItemMasterType" final="extension">
<xs:complexContent>
<xs:extension base="oa:ItemMasterType">
<xs:sequence>
<xs:element name="ExtendedThing" type="TestType" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ItemMaster" type="ItemMasterType" block="substitution" substitutionGroup="oa:ItemMaster" final="extension"/>
So... is it possible using XSD to force the overriding of a substitued construct, or is this impossible ? Or, is there at least a way to make the IDE (XMLSpy) enforce this behaviour ?
Any thoughts would be much appreciated. Thanks,
Damian
A smile is worth a thousand kind words. So smile, it's easy!