Restriction on "AnyValidXML"

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