RE: XML Schema WG Comments on XInclude

> -----Original Message-----
> From: Mary Holstege [mailto:holstege@mathling.com]
> Sent: Friday, January 18, 2002 11:06 AM

Thanks for the schema suggestion.  Only in the last week or so have I
begun using Schema-aware tools to create and validate schemas.
Hopefully this will reduce silly mistakes!

If we don't decide to restrict the placement of extension elements,
would the following schema give us the constraint we want?  (Zero or one
xi:fallback element child, no xi:include children, and anything else
including non-namespaced elements in any order.)

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xi="http://www.w3.org/2001/XInclude"
           targetNamespace="http://www.w3.org/2001/XInclude">

  <xs:element name="include">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:any namespace="#other" processContents="lax"/>
        </xs:choice>
        <xs:element ref="xi:fallback" minOccurs="0"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:any namespace="#other" processContents="lax"/>
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="href" type="xs:anyURI" use="required"/>
      <xs:attribute name="parse" use="optional" default="xml">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="xml"/>
            <xs:enumeration value="text"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="encoding" type="xs:string" use="optional"/>
      <xs:anyAttribute namespace="##other" processContents="lax"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="fallback">
    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="xi:include"/>
        <xs:any namespace="#other" processContents="lax"/>
      </xs:choice>
      <xs:anyAttribute />
    </xs:complexType>
  </xs:element>

</xs:schema>

> The full schema:
> 
>  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>             xmlns:xi=http://www.w3.org/2001/XInclude
>             targetNamespace="http://www.w3.org/2001/XInclude">
>    <xs:element name="include">
>      <xs:complexType mixed="true">
>        <xs:choice minOccurs="0" maxOccurs="unbounded">
>          <xs:element ref="xi:fallback"/>
>          <xs:any namespace="#other" processContents="lax"/>
>        </xs:choice>
>        <xs:attribute name="href" type="xs:anyURI" use="required"/>
>        <xs:attribute name="parse" use="optional" default="xml">
>          <xs:simpleType>
>            <xs:restriction base="xs:string">
>              <xs:enumeration value="xml"/>
>              <xs:enumeration value="text"/>
>            </xs:restriction>
>          </xs:simpleType>
>        </xs:attribute>
>       <xs:attribute name="encoding" type="xs:string" use="optional"/>
>       <xs:anyAttribute namespace="##other" processContents="lax" />
>     </xs:complexType>
>   </xs:element>
> 
>   <xs:element name="fallback">
>    <xs:complexType mixed="true">
>      <xs:choice minOccurs="0" maxOccurs="unbounded">
>        <xs:element ref="xi:include"/>
>        <xs:any namespace="##other" processContents="lax"/>
>      </xs:choice>
>      <xs:anyAttribute namespace="##other" processContents="lax" />
>    </xs:complexType>
>  </xs:element>
> </xs:schema>
> 
> -- Mary Holstege
>    for the XML Schema WG

Received on Friday, 18 January 2002 20:09:42 UTC