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

Re: Doubt about validation

From: Paul Warren <pdw@decisionsoft.com>
Date: 20 Dec 2002 10:01:21 +0000
To: Santino Troiani <santino.troiani@next.it>
Cc: xmlschema-dev@w3.org
Message-Id: <1040378481.1430.139.camel@tobol.dsl.local>

On Fri, 2002-12-20 at 09:05, Santino Troiani wrote:

> I have a subtle problem. I just uploaded the attached XSD schema file to http://www.w3.org/2000/06/webdata/xsv to be sure the schema is valid, and your validator says that all is OK.
> 
> But when I use the schema to validate the XML document also attached I get an error, from any of the available parsers (not from all); in particular:
>     Xerces C++,      error
>     MSXML 4.0,      no error
>     XMLSpy 4.x,     no error
>     .NET (System.Xml),  error

I believe (and I'm sure I'll be corrected if I'm wrong) that xsv only
validates schemas by validating them against the schema for schemas. 
This is a start, but it does not test the actual schema content, such as
the problem you have below.

Schema validating parsers should pick up schema errors in the process of
parsing the schema in order to create the validator, but this isn't
usually a rigorous test for schema validity - whether problems are
picked up is often dependent on the instance document you are testing
with, and the error messages reported are often misleading.

In my experience, the best way to ensure schema validity is IBM's sqc
tool.  This tool is designed specifically to test schema quality, and
usually reports errors with meaningful messages.  Regarding your schema
it says:

ERROR
 file = file:/home/local/pdw/tmp/MessageTable.xsd line 45 column 19
SEVERITY: 1
ERROR TYPE: 2
MESSAGE 
Ambiguous content model : the following particles overlap :
<xs:element maxOccurs="1" minOccurs="1" name="Text" nillable="false"
type="xs:string"/>
, 
<xs:element maxOccurs="1" minOccurs="1" name="Text" nillable="false"
type="xs:string"/>
 
> 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.

Paul
-- 
Paul Warren, Client Services           DecisionSoft Limited
+44-1865-203192                        http://www.decisionsoft.com
Received on Friday, 20 December 2002 05:01:25 GMT

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