Re: CR Feedback and Implementation

> From: "Falk, Alexander" <al@altova.com>
> To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
> Cc: "'w3c-xml-schema-ig@w3.org'" <w3c-xml-schema-ig@w3.org>
> Date: Thu, 14 Dec 2000 17:23:42 +0100
> Subject: CR Feedback and Implementation


That's a scary example. I thought it would violate the "Element
Declarations Consistent" constraint.  What am I missing?

> 2) consider the question of non-deterministic content models with respect to
> local element declarations, e.g. in the following schema:
> 
>         <?xml version="1.0" encoding="UTF-8"?>
>         <!-- edited with XML Spy v3.5 NT beta 2 build Dec 11 2000
> (http://www.xmlspy.com) by Alexander Falk (Altova, Inc.) -->
>         <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
> elementFormDefault="qualified">
>                 <xsd:element name="a">
>                         <xsd:complexType>
>                                 <xsd:sequence>
>                                         <xsd:element name="b" minOccurs="0"
> maxOccurs="unbounded">
>                                                 <xsd:complexType>
>                                                         <xsd:sequence>
>                                                                 <xsd:element
> name="c" type="xsd:string"/>
>                                                                 <xsd:element
> name="d" type="xsd:string" minOccurs="0"/>
>                                                         </xsd:sequence>
>                                                 </xsd:complexType>
>                                         </xsd:element>
>                                         <xsd:element name="b" minOccurs="0"
> maxOccurs="unbounded">
>                                                 <xsd:complexType>
>                                                         <xsd:sequence>
>                                                                 <xsd:element
> name="c" type="xsd:integer"/>
>                                                                 <xsd:element
> name="e" type="xsd:string" minOccurs="0"/>
>                                                         </xsd:sequence>
>                                                 </xsd:complexType>
>                                         </xsd:element>
>                                 </xsd:sequence>
>                         </xsd:complexType>
>                 </xsd:element>
>         </xsd:schema>
> 
> which declares two local elements <b> with different content models, that
> make the validation process entirely non-deterministic when it comes to the
> following example XML instance document based on this schema:
> 
>         <?xml version="1.0" encoding="UTF-8"?>
>         <!-- edited with XML Spy v3.5 NT beta 2 build Dec 11 2000
> (http://www.xmlspy.com) by Alexander Falk (Altova, Inc.) -->
>         <a xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="multilocaldiff.xsd">
>                 <b>
>                         <c>0</c>
>                 </b>
>         </a>
> 
> Is the <b> element in this example the first or second local element b in
> the above schema - or more specifically - should the contents of c be
> interpreted as an xsd:string or xsd:integer? Only if the XML instance
> document is actually extended a bit:
> 
>         <?xml version="1.0" encoding="UTF-8"?>
>         <!-- edited with XML Spy v3.5 NT beta 2 build Dec 11 2000
> (http://www.xmlspy.com) by Alexander Falk (Altova, Inc.) -->
>         <a xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="multilocaldiff.xsd">
>                 <b>
>                         <c>0</c>
>                         <e/>
>                 </b>
>         </a>
> 
> it would theoretically be possible to validate this document against the
> schema, although, the fact that this kind of "grammar" defined by the schema
> entirely violates any LL1 condition, allowing such a construct makes it very
> hard to achieve compatibility between different vendors of schema-based
> validation.
> 
> I would, therefore, recommend that the use of multiple locally declared
> elements with the same name within one parent are either discouraged or
> outright forbidden by the Schema specification.

Received on Thursday, 14 December 2000 23:25:49 UTC