W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2004

Changing the type of an attribute

From: Hans Teijgeler <hans.teijgeler@quicknet.nl>
Date: Tue, 21 Dec 2004 11:30:24 +0100
Message-ID: <41C7FB40.E9EBBBBD@quicknet.nl>
To: xml schema dev <xmlschema-dev@w3.org>
CC: "paap, onno" <onno.paap@fluor.com>
Folks,

Below are the snippets of a schema that are relevant to a problem I stumbled
across.

I validated this schema against XSV and got the following error:

file:///usr/local/XSV/xsvlog/tmpchD_tWuploaded:2265:5: Invalid: restricting
attribute with type
{http://www.tc184-sc4.org/iso15926-7/datamodel/2005-1.xsd}any-enumerated_set_of_class

not derived from declared base's attribute's type
{http://www.tc184-sc4.org/iso15926-7/datamodel/2005-1.xsd{any-thing}

The code snippets are:

        <xs:simpleType name="id_pattern">
                <xs:restriction base="xs:NMTOKEN">
                        <xs:pattern
value="([a-zA-Z][a-zA-Z0-9]__)*[a-zA-Z0-9\.\-]+(&#x00B7;[a-zA-Z0-9\.\-]+)?"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="idref_pattern">
                <xs:restriction base="xs:NMTOKEN">
                        <xs:pattern
value="([a-zA-Z][a-zA-Z0-9]__)*[a-zA-Z0-9\.\-]+(&#x00B7;[a-zA-Z0-9\.\-]+)?"/>
                </xs:restriction>
        </xs:simpleType>
        <!--=====================-->
        <xs:complexType name="thing" abstract="true">
                <xs:attribute name="id" type="id_pattern" use="required"/>
        </xs:complexType>
        <xs:simpleType name="any-thing">
                <xs:restriction base="idref_pattern"/>
        </xs:simpleType>
        <!--=====================-->
        <xs:complexType name="class">
                <xs:complexContent>
                        <xs:extension base="thing"/>
                </xs:complexContent>
        </xs:complexType>
        <xs:simpleType name="any-class">
                <xs:restriction base="idref_pattern"/>
        </xs:simpleType>
        <!--=====================-->
        <xs:complexType name="enumerated_set_of_class">
                <xs:complexContent>
                        <xs:extension base="class_of_class"/>
                </xs:complexContent>
        </xs:complexType>
        <xs:simpleType name="any-enumerated_set_of_class">
                <xs:restriction base="idref_pattern"/>
        </xs:simpleType>
        <!--=====================-->
        <xs:complexType name="functional_mapping">
                <xs:complexContent>
                        <xs:extension base="relationship">
                                <xs:attribute name="input" type="any-thing"
use="required"/>
                                <xs:attribute name="result" type="any-thing"
use="required"/>
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>
        <!--=====================-->
        <xs:complexType name="difference_of_set_of_class">
                <xs:complexContent>
                        <xs:restriction base="functional_mapping">
                                <xs:attribute name="input"
type="any-enumerated_set_of_class"/> <!--problem spot-->
                                <xs:attribute name="result" type="any-class"/>
                        </xs:restriction>
                </xs:complexContent>
        </xs:complexType>
        <!--=====================-->

I produced this code with an older version (4.4) of XML Spy, and that seemed to
be correct (perhaps at that time?).

NOTE: From the rest of the schema one can derive that we deal here with the
following path through the model hierarchy:
thing >> class >> class_of_class >> enumerated_set_of_class.

You may wonder what I tried to achieve. That is a kind of idref constraint,
where I cannot use idref, because:

   * the referenced id's are not part of the XML document (they are there,
     somewhere on the Internet)
   * the constraint shall be valid for all elements that are typed with this
     complexType
   * the types like "any-enumerated_set_of_class" are in fact hidden Processing
     Instructions, because the id referenced in the attribute "input" shall not
     only follow that pattern, but also belong to an element (instance) that is
     of the type "enumerated_set_of_class".

Any suggestions how to solve this problem?

Regards,
Hans


Received on Tuesday, 21 December 2004 10:28:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:48 GMT