W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Restricting an anyType?

From: <Simon.Cox@csiro.au>
Date: Thu, 21 Feb 2002 14:25:50 +0800
Message-ID: <116D27C8E12BD411B3AB00B0D022B0B8AF0A19@yate.wa.csiro.au>
To: xmlschema-dev@w3.org
In the following schema I use an anyType element to head a
substitutionGroup.  
I use this in a content model for ValType, with unlimited cardinality.  
I declare two elements in the substitutionGroup.  
Then I try to derive NewValType containing these, by restriction from
ValType.  

Spy says OK, but Xerces (via SQC) says this is illegal.  

Who's correct?

=============
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified">
  <element name="_Object" type="anyType" abstract="true"/>
  <element name="Object1" type="decimal"/>
  <element name="Object2" type="date"/>
  <complexType name="ValType">
    <sequence>
      <element ref="gml:_Object" maxOccurs="unbounded"/>
    </sequence>
  </complexType>
  <element name="val" type="gml:ValType"/>
  <complexType name="NewValType">
    <complexContent>
      <restriction base="gml:ValType">
        <sequence>
          <element ref="gml:Object1"/>
          <element ref="gml:Object2" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
      </restriction>
    </complexContent>
  </complexType>
  <element name="newVal" type="gml:NewValType"/>
</schema>
==============


_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon

> -----Original Message-----
> From: Simon.Cox@csiro.au [mailto:Simon.Cox@csiro.au]
> Sent: Tuesday, 19 February 2002 6:16 PM
> To: vdv@dyomedea.com; xmlschema-dev@w3.org
> Subject: RE: block="substitution" in local element definitions
> 
> 
> Did I miss the answer to this?  
> 
> In the primer it says [1] 
> 
> "... elements can be assigned to a special group of elements 
> that are said
> to be substitutable for a particular named element called the 
> head element.
> (Note that the *head element* must be declared as a global element.) "
> 
> I had drawn the concusion that an element must be global to 
> be the /head/ of
> a substitutionGroup, but there is no such restriction on 
> local elements, so
> they can be /members/ of substitutionGroups.  
> 
> But in Structures it says at [2] 
> 
> "[Definition:]  Through the new mechanism of element 
> substitution groups,
> XML Schemas provides a more powerful model supporting 
> substitution of one
> named element for another. Any top-level element declaration 
> can serve as
> the defining element, or head, for an element substitution 
> group. Other
> *top-level* element declarations, regardless of target 
> namespace, can be
> designated as members of the substitution group headed by 
> this element. "
> 
> Is this the normative restriction in the spec?  
> I cannot find any other reference requiring substitutionGroup 
> members or
> heads to be global/top-level ...
> 
> [1] http://www.w3.org/TR/xmlschema-0/#ref25
> [2] 
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-equivalenceClass
_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon

> -----Original Message-----
> From: Eric van der Vlist [mailto:vdv@dyomedea.com]
> Sent: Wednesday, 6 February 2002 9:07 PM
> To: xmlschema-dev@w3.org
> Subject: block="substitution" in local element definitions
> 
> 
> Hi,
> 
> What's the point of allowing block="substitution" in a local element 
> definition since, unless I have missed something, local 
> elements cannot 
> be members of a substitution group ?
> 
> Thanks
> 
> Eric
> -- 
> Rendez-vous a Paris pour mes formations XML/XSLT.
>                                            
> http://dyomedea.com/formation/
> --------------------------------------------------------------
> ----------
> Eric van der Vlist       http://xmlfr.org            
> http://dyomedea.com
> http://xsltunit.org      http://4xt.org           
> http://examplotron.org
> --------------------------------------------------------------
> ----------
> 
Received on Thursday, 21 February 2002 01:34:26 GMT

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