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

Re: variable element names

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 19 Nov 2002 19:13:13 +0000
To: Bob Schloss <rschloss@us.ibm.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bbs4lid9y.fsf@erasmus.inf.ed.ac.uk>

I think you've identified a bug in Noah's solution.

The processContents attribute of wildcards is not inherited.  So
given

        <parent>
                <var>
                        <x>123</x>
                        <w><a/></w>
                        <z/>
                </var>
        <parent>

and writing

<xs:element name="parent">
 <xs:complexType>
  <xs:sequence>
   <xs:any processContents="strict"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

in its schema, we would have a requirement that a declaration for the
_var_ element be available.  There's no way to make that requirement
inherited.

So what you actually want is 

<xs:element name="parent">
 <xs:complexType>
  <xs:sequence>
   <xs:any processContents="lax"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

<xs:element name="x" type="..."/>
<xs:element name="y" type="..."/>
<xs:element name="z" type="..."/>

By using 'lax' you avoid the (undesirable for your example)
requirement for a declaration for 'var', but because lax validation
_is_ recursive, and declarations for x, y and z _are_ present,
requires that they conform to those declarations.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Tuesday, 19 November 2002 14:13:15 GMT

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