You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2011/03/03 13:53:36 UTC

[jira] Issue Comment Edited: (XERCESJ-1497) xsd validation issue with base type of boolean not correctly validated when 0 or 1 are used.

    [ https://issues.apache.org/jira/browse/XERCESJ-1497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001882#comment-13001882 ] 

Michael Glavassevich edited comment on XERCESJ-1497 at 3/3/11 12:53 PM:
------------------------------------------------------------------------

Your XML Schema document is invalid. The default value that you specify on an attribute declaration needs to satisfy the following constraint [1]: "if there is a {value constraint}, the canonical lexical representation of its value must be ·valid· with respect to the {type definition} as defined in String Valid (§3.14.4)." 

In the schema the lexical value specified for the default is "1". Its canonical lexical representation is "true", which is not valid with respect to the pattern "0|1" on the attribute's type.

[1] http://www.w3.org/TR/xmlschema-1/#coss-attribute

      was (Author: mrglavas@ca.ibm.com):
    Your XML Schema document is invalid. The default value that you specify on an attribute value needs to satisfy the following constraint [1]: "if there is a {value constraint}, the canonical lexical representation of its value must be ·valid· with respect to the {type definition} as defined in String Valid (§3.14.4)." 

In the schema the lexical value specified for the default is "1". Its canonical lexical representation is "true", which is not valid with respect to the pattern "0|1" on the attribute's type.

[1] http://www.w3.org/TR/xmlschema-1/#coss-attribute
  
> xsd validation issue with base type of boolean not correctly validated when 0 or 1 are used.
> --------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1497
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1497
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>         Environment: Windows 
>            Reporter: Peter_Lenahan@ibi.com
>
> The error surfaced in the Eclipse Validator telling me that an .xsd file had an error,
> I validated the file on the W3C site and it validated OK.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=337932
> IBM debugged it and replied that it was a bug in Xerces, and suggested I report the bug to Apache.
> The code snippet correctly validates on the w3c site.
> The w3c standard defines a boolean to allow 4 values,  true, false, 0, and 1
> The eclipse xsd validator fails when 0 and 1 are defined in the case below.
> http://www.w3.org/TR/xmlschema-2/#boolean
> 3.2.2 boolean
> [Definition:]  boolean has the - value space-  required to support the
> mathematical concept of binary-valued logic: {true, false}.
> 3.2.2.1 Lexical representation
> An instance of a datatype that is defined as - boolean-  can have the following
> legal literals {true, false, 1, 0}.
> The Eclipse Validator fails then the values of 0 and 1 are used, but passes
> when true and false are used.
> <xs:attribute name="root" default="1" >
>    <xs:annotation>
>      <xs:documentation>
>        'root' can be used to distinguish serialization roots from 
>        other elements that are present in a serialization but are 
>        not roots of a serialized value graph 
>      </xs:documentation>
>    </xs:annotation>
>    <xs:simpleType>
>      <xs:restriction base='xs:boolean'>
>        <xs:pattern value="0|1" />
>      </xs:restriction>
>    </xs:simpleType>
>  </xs:attribute>

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org