W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2005

RE: Changing the type of an attribute

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Mon, 3 Jan 2005 10:25:42 -0500
To: "'Hans Teijgeler'" <hans.teijgeler@quicknet.nl>, "'xml-schema, developers-forum'" <xmlschema-dev@w3.org>
Message-ID: <E1ClU5k-0002Ba-Px@frink.w3.org>

Hello Hans,

When you restrict a complex type and change the type of an attribute, that
new type must be a restriction (directly or indirectly) of the base type.
In your case, any-enumerated_set_of_class is not derived from any-thing.
They are both derived from idref_pattern, so they are "siblings" in the
derivation chain.

Is there any reason you can't make any-enumerated_set_of_class a restriction
of any-thing?

Hope that helps,
Priscilla 

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
-----------------------------------------------------  

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Hans Teijgeler
> Sent: Friday, December 31, 2004 5:01 AM
> To: xml-schema, developers-forum
> Cc: thompson, henry
> Subject: Re: Changing the type of an attribute
> 
> Folks,
> 
> I sent this request for help ten days ago, but unfortunately 
> got no reaction
> whatsoever.
> 
> Can anybody help?
> 
> regards,
> Hans
> 
> ==============================
> 
> Hans Teijgeler wrote:
> 
> > 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-s
> > 4.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 Monday, 3 January 2005 15:25:56 GMT

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