Dick Deneer <[EMAIL PROTECTED]> wrote on 01/04/2006 
12:29:46 PM:

> But this is not consistent with the fact that an instance document with 
>   a "0" value is valid.

I agree that it seems strange that an instance document with "0" is valid 
but a default value of "0" is invalid, but once again it turns out that 
this is what the Schema Spec requires.  For an instance document, the 
canonical representation is used *only* if there is a "fixed" value 
constraint [1] (Suppose the fixed value of an element is "0.00" and the 
instance document specifies "0".  It makes sense to convert them both to a 
canonical representation "0.0" before comparing them for equality).  Thus, 
in response to the issue at hand, since we're not using a fixed value 
constraint, we're not using the canonical representation, and therefore 
"0" is a valid value of type MyInteger.

When parsing a schema, I'm not sure why the Schema spec requires that the 
canonical value of default value constraints are valid.  It does seem (to 
me) like this should only apply to fixed value constraints, as is done 
with instance documents.  Someone with more knowledge of schema than me 
might be able to answer this.  However, unless the Schema spec changes, 
the current behaviour of Xerces is technically correct, both when saying 
"0" is valid for instance documents and "0" is invalid for default values 
in schema documents.

[1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#cvc-elt (see 
clause 5.2.2)

-- 
Peter McCracken
XML Parser Development
IBM Toronto Lab
Phone: 905-413-5201 T/L 969-5201
Email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to