W3C home > Mailing lists > Public > www-xml-xinclude-comments@w3.org > January 2002

RE: XML Schema WG Comments on XInclude

From: Jonathan Marsh <jmarsh@microsoft.com>
Date: Fri, 18 Jan 2002 17:09:10 -0800
Message-ID: <330564469BFEC046B84E591EB3D4D59C049AC8E8@red-msg-08.redmond.corp.microsoft.com>
To: <holstege@mathling.com>, <www-xml-xinclude-comments@w3.org>, "XML Core WG" <w3c-xml-core-wg@w3.org>
Cc: <w3c-xml-schema-wg@w3.org>
> -----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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:31 UTC