Re: Does This Violate UPA?

"Dare Obasanjo" <dareo@microsoft.com> writes:

> A local decl doesn't make it different. That was part of my "No" answer. 
>  
> I have a followup question involving Element Declaration Consistent. It seems to disallow 
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>  
> <xs:element name="root">
>  <xs:complexType>
>   <xs:sequence>
>    <xs:element name="foo" type="xs:string" >
>    <xs:element name="foo" type="xs:integer" />
>   </xs:sequence>
>   </xs:complexType>
>  </xs:element>
>  
> </xs:schema>
>  
> yet allow 
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>  
> <xs:element name="root">
>  <xs:complexType>
>   <xs:sequence>
>    <xs:element name="foo" type="xs:integer" default="10" >
>    <xs:element name="foo" type="xs:integer" fixed="5" />
>    <xs:element name="foo" type="xs:integer" nillable="true" />
>   </xs:sequence>
>   </xs:complexType>
>  </xs:element>
>  
> </xs:schema>
>  
> is this by design or an oversight in the recommendation? It seems
> rather arbitrary to disallow one and not the other.

You're right about what's in and what's out, and it is by design.
This constraint is there so that type inference from XPath expressions
is straight-forward, as I recall.  That is, /root/foo is always an
integer in the second example, but not in the first.

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, 5 November 2002 13:38:21 UTC