-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Change elementFormDefault in Schemas to "unqualified"
In Emix, ItemBasewas conceived of as establishing a pattern of three values for all derived elements.
<xs:element name="itemDescription" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="itemUnits" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element ref="scale:siScaleCode" minOccurs="0" maxOccurs="1"/>
EMIX-conformant schemas (which include Power) use the pattern of derivation through restriction to specify the actual types. For example, Apparent Power restricts item choices as follows:
<xs:complexType name="PowerApparentType" mixed="false">
<xs:annotation>
<xs:documentation>Apparent Power measured in volt-amperes (VA)</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:restriction base="PowerItemType">
<xs:sequence>
<xs:element name="itemDescription" type="xs:string" fixed="ApparentPower"/>
<xs:element name="itemUnits" type="xs:string" fixed="VA"/>
<xs:element ref="scale:siScaleCode"/>
<xs:element ref="voltage"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
While this pattern works well in a single schema, it fails if the derived type is in a separate schema from the archetype. In particular, each element generates the following error:
"rcase-NameAndTypeOK.1: The declarations'
s and
{target namespace}s are not the same: restriction element is <xs:element name="itemDescription"> and base element is <xs:element name="itemDescription">."
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#rcase-NameAndTypeOK
This problem can be eliminated if the elementFormDefault for each Schema is changed to "unqualified". The current value is "qualified".
http://www.w3.org/TR/xmlschema-0/#ref50
This approach has been tested in XMLSpy and in code generated by Liquid Technologies.