[XML Schema] Invalid constraint value ambiguity

  • Thread starter Stanimir Stamenkov
  • Start date
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">
<xs:pattern 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
 
S

Stanimir Stamenkov

Stanimir said:
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>

Seems I've already got a definitive answer from Sandy Gao on the
Xercec-J Users list, that it looks like hole in the spec. Still I would
welcome any additional comments, thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top