S
Stanimir Stamenkov
This is an issue I've got using the Xerces-J 2.7.1 release when loading
the following schema:
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sample-elem" type="MyInteger" default="0" />
<xs:simpleType name="MyInteger">
<xs:restriction base="xs:decimal">
<xsattern value="[\-+]?[0-9]+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
Xerces gives me an error:
e-props-correct.2: Invalid value constraint value '0' in element
'sample-elem'.
I've tried the XML Schema Validator on the W3C site and it gave me no
error.
So I've initially posted on the Xerces-J Users list [1] and I was
pointed the default value should be also valid to the canonical lexical
representation of the datatype [2], where "0" have to be "0.0"
(according to the canonical lexical representation of the 'decimal'
type), but then it is not valid to the pattern specified, so schema as
the given one is effectively invalid.
Now as far as I understand the spec, the default value should be valid
according to the canonical lexical representation of the "MyInteger"
type and not the 'decimal' one, but then how is the canonical lexical
representation of user defined types determined, is it specified at
all?
[1] "[XML Schema] Invalid constraint value error (bug?)"
<http://mail-archives.apache.org/mod_mbox/xerces-j-users/200601.mbox/browser>
[2] http://www.w3.org/TR/xmlschema-1/#e-props-correct
the following schema:
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sample-elem" type="MyInteger" default="0" />
<xs:simpleType name="MyInteger">
<xs:restriction base="xs:decimal">
<xsattern value="[\-+]?[0-9]+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
Xerces gives me an error:
e-props-correct.2: Invalid value constraint value '0' in element
'sample-elem'.
I've tried the XML Schema Validator on the W3C site and it gave me no
error.
So I've initially posted on the Xerces-J Users list [1] and I was
pointed the default value should be also valid to the canonical lexical
representation of the datatype [2], where "0" have to be "0.0"
(according to the canonical lexical representation of the 'decimal'
type), but then it is not valid to the pattern specified, so schema as
the given one is effectively invalid.
Now as far as I understand the spec, the default value should be valid
according to the canonical lexical representation of the "MyInteger"
type and not the 'decimal' one, but then how is the canonical lexical
representation of user defined types determined, is it specified at
all?
[1] "[XML Schema] Invalid constraint value error (bug?)"
<http://mail-archives.apache.org/mod_mbox/xerces-j-users/200601.mbox/browser>
[2] http://www.w3.org/TR/xmlschema-1/#e-props-correct