Re: Doubt about validation

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 UTC