W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2004

Restriction on "AnyValidXML"

From: Miroslaw Kalinowski <mkalinowski@mikconsulting.net>
Date: 27 Feb 2004 12:23:53 -0700
To: <www-xml-schema-comments@w3.org>
Message-ID: <JAEJLCENLFDBKMPHCPALIEGOCCAA.mkalinowski@mikconsulting.net>




I hope this is the right place to raise this issue.

Version 1 of my schema defines type "MyType" which allows any valid XML to
appear in document.
The content of elements defined from this type is not processed.

v1.xsd:
  <xsd:complexType name="MyType">
      <xsd:complexContent>
	<xsd:restriction base="xsd:anyType">
          <xsd:sequence>
            <xsd:any minOccurs="0" maxOccurs="unbounded"
processContents="skip"/>
          </xsd:sequence>
          <xsd:anyAttribute/>
	</xsd:restriction>
      </xsd:complexContent>
  </xsd:complexType>

I version 2 of the schema I am trying to put some restrictions on
what is allowed to appear in "MyType" (and process them).
Schema v2a.xsd works.
Schema v2b.xsd fails verification ("Invalid particle derivation by
restriction. An error occurred at ... .").

v2a.xsd:
  <xs:redefine schemaLocation="v1.xsd">
    <xsd:complexType name="MyType">
      <xsd:complexContent>
        <xsd:restriction base="MyType">
          <xsd:sequence>
            <xsd:element name="element1" type="xsd:string"/>
          </xsd:sequence>
        </xsd:restriction>
      </xsd:complexContent>
    </xsd:complexType>
  </xs:redefine>

v2b.xsd:
  <xs:redefine schemaLocation="v1.xsd">
    <xsd:complexType name="MyType">
      <xsd:complexContent>
        <xsd:restriction base="MyType">
          <xsd:sequence>
            <xsd:element name="element1" type="xsd:string"/>
		<xsd:element name="element2" type="xsd:string"/>
          </xsd:sequence>
        </xsd:restriction>
      </xsd:complexContent>
    </xsd:complexType>
  </xs:redefine>

Is there any way to define in version 2 type "MyType", so it can contain
arbitrary type.
And still be able to produce document which can be verified by both version
1 and 2 schemas?

Should v2b.xsd fail verification?

mirek
Received on Friday, 27 February 2004 14:25:44 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:02 UTC