Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If it is permissible to alter the schema the following should work but an explicit xsi:type attribute will be needed for elements of the base type in the XML instances of this schema. The way it works is a base type has been created with the class attribute, extended to include the size and encoding attributes, and then restricted. Elements can be declared in the schema as the base type and instances can use the restricted types.</p> <pre><code>&lt;!-- Base Read Mode Simple Type --&gt; &lt;xs:simpleType name="MyReadModeType"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="CHAR"/&gt; &lt;xs:enumeration value="BIT"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;!-- Char Read Mode Simple Type --&gt; &lt;xs:simpleType name="MyCharReadModeType"&gt; &lt;xs:restriction base="tns:MyReadModeType"&gt; &lt;xs:enumeration value="CHAR"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;!-- Bit Read Mode Simple Type --&gt; &lt;xs:simpleType name="MyBitReadModeType"&gt; &lt;xs:restriction base="tns:MyReadModeType"&gt; &lt;xs:enumeration value="BIT"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;!-- Set Read Mode Base Type --&gt; &lt;xs:complexType name="MySetReadModeType" abstract="true"&gt; &lt;xs:attribute name="class" type="tns:MyReadModeType" /&gt; &lt;/xs:complexType&gt; &lt;!-- Set Char Mode Extension --&gt; &lt;xs:complexType name="MyBaseSetCharReadModeType" abstract="true"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="tns:MySetReadModeType"&gt; &lt;xs:attribute name="size" type="tns:MyReadModeSizeType" use="prohibited" /&gt; &lt;xs:attribute name="encoding" type="xs:string" use="required"/&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;!-- Set Char Mode Type --&gt; &lt;xs:complexType name="charMode"&gt; &lt;xs:complexContent&gt; &lt;xs:restriction base="tns:MyBaseSetCharReadModeType"&gt; &lt;xs:attribute name="size" type="tns:MyReadModeSizeType" use="prohibited" /&gt; &lt;xs:attribute name="encoding" type="xs:string" use="required"/&gt; &lt;xs:attribute name="class" type="tns:MyCharReadModeType" use="optional" default="CHAR" /&gt; &lt;/xs:restriction&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;!-- Set Bit Mode Extension --&gt; &lt;xs:complexType name="MyBaseSetBitReadModeType" abstract="true"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="tns:MySetReadModeType"&gt; &lt;xs:attribute name="size" type="tns:MyReadModeSizeType" use="required" /&gt; &lt;xs:attribute name="encoding" type="xs:string" use="prohibited"/&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;!-- Set Bit Mode Type --&gt; &lt;xs:complexType name="bitMode"&gt; &lt;xs:complexContent&gt; &lt;xs:restriction base="tns:MyBaseSetBitReadModeType"&gt; &lt;xs:attribute name="size" type="tns:MyReadModeSizeType" use="required" /&gt; &lt;xs:attribute name="encoding" type="xs:string" use="prohibited"/&gt; &lt;xs:attribute name="class" type="tns:MyBitReadModeType" use="optional" default="BIT"/&gt; &lt;/xs:restriction&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload