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

Re: Doubt about validation

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 20 Dec 2002 10:37:37 +0000
Message-ID: <167695218.20021220103737@jenitennison.com>
To: Santino Troiani <santino.troiani@next.it>
CC: xmlschema-dev@w3.org, Paul Warren <pdw@decisionsoft.com>

Hi Santino,

Just to follow on from Paul's reply:
> On Fri, 2002-12-20 at 09:05, Santino Troiani wrote:
>> The error seems to be in the definition af the type "typeparametersyntax":
>> <xs:complexType name="typeparametersyntax">
>>   <xs:annotation>
>>     <xs:documentation>
>>       Fixed text and/or variable data but not empty!
>>     </xs:documentation>
>>   </xs:annotation>
>>   <xs:choice>
>>     <xs:element name="Text" type="xs:string"/>
>>     <xs:sequence>
>>       <xs:element name="Text" type="xs:string"/>
>>       <xs:element ref="data"/>
>>     </xs:sequence>
>>     <xs:element ref="data"/>
>>   </xs:choice>
>> </xs:complextype>
>> 
>> the parsers that report error claim for non-deterministic content model (not so clearly, however!).
>> 
>> Why your parser doesn't report any error ?
>> Can you give me any suggestion to solve the problem ?
>
> The problem here is that an item called "Text" can be validated
> against either of Text definitions within the choice. The schema
> validating parser needs to associate each element with a single
> definition within the schema at parse time. As it stands, it is
> ambiguous which definition a "Text" element would be validated
> against.

You could solve this problem with the following content model:

  <xs:choice>
    <xs:sequence>
      <xs:element name="Text" type="xs:string" />
      <xs:element ref="data" minOccurs="0" />
    </xs:sequence>
    <xs:element ref="data" />
  </xs:choice>

In other words, there must either be a Text element, optionally
followed by a data element, or just a data element: one or both of
Text and data must appear.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 20 December 2002 05:37:44 GMT

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