Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Changing the type of an attribute

From: Hans Teijgeler <hans.teijgeler@--------.-->
To: xml schema dev <xmlschema-dev@--.--->
Date: 12/21/2004 12:30:00 PM
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 XMLSpy">XMLSpy, 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent