Re: Detecting of schema errors

Hi,

Mike_Leditschke@nemmco.com.au wrote:
> 
> I have the following two definitions in a schema. You'll notice the
> second is using a hyphen not an underscore as per the pattern.
> 
>      <xsd:simpleType name="ReleaseIdentifier">
>           <xsd:restriction base="xsd:string">
>                <xsd:pattern value="r[0-9]*|r[0-9]*_[a-z][0-9]*"/>
>           </xsd:restriction>
>      </xsd:simpleType>
> 
>      <xsd:simpleType name="r3">
>           <xsd:restriction base="ReleaseIdentifier">
>                <xsd:enumeration value="r3-e3"/>
>           </xsd:restriction>
>      </xsd:simpleType>
> 
> Should the parser flag an error when loading the schema, or only
> when validating an instance based on a schema using r3?

Actually, the recommendation says that that the tools "may" report an
error in this case.

More precisely:

http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#rf-enumeration

4.3.5.5 Constraints on enumeration Schema Components

Schema Component Constraint: enumeration valid restriction 
It is an ˇerrorˇ if any member of {value} is not in the ˇvalue spaceˇ of
{base type definition}. 

And the definition of ˇerrorˇ is:

http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#dt-error

[Definition:]  error 
A violation of the rules of this specification; results are undefined.
Conforming software ˇmayˇ detect and report an error and ˇmayˇ recover
from it. 

> Both XMLSpy 4.0b1 and XSV happily ignore the error as far as the
> schema is concerned.
> 
> XMLSpy reports an error when validating an instance even if the value
> "r3-e3" is provided, saying that it doesn't match the regular expression.
> 
> XSV is happy provided the instance uses the string "r3-e3" and doesn't
> report the value as violating the regular expression. Is this a bug? I
> recall
> that regular expressions were not supported in XSV a while back but
> they are not mentioned in the "Not Implemented yet" section of the
> latest status page.

They "might" report it, but since it's considered to be "a violation of
the rules of this specification" which "results are undefined", I guess
that everything is acceptable !

Eric

PS: I find it rather weird to explicitly define than results are
undefined. 
> Any help much appreciated.
> 
> Regards
> Michael
> 
> ------------------------------------------
> This e-mail is confidential.  If you are not the intended recipient, any use, disclosure or copying of this document is unauthorised and prohibited.  If you have received this document in error, please delete the email and notify me by return email or by phoning the NEMMCO Helpdesk on 1300 300 295.

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Monday, 25 June 2001 03:24:04 UTC