[XML Schema] Invalid constraint value ambiguity

Discussion in 'XML' started by Stanimir Stamenkov, Jan 5, 2006.

  1. 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
    Stanimir Stamenkov, Jan 5, 2006
    #1
    1. Advertising

  2. Re: Invalid constraint value ambiguity

    Stanimir Stamenkov wrote:

    > 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.

    --
    Stanimir
    Stanimir Stamenkov, Jan 5, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Whitlow
    Replies:
    1
    Views:
    396
    C. M. Sperberg-McQueen
    Sep 23, 2003
  2. Replies:
    5
    Views:
    753
    Priscilla Walmsley
    Jan 16, 2006
  3. Replies:
    0
    Views:
    439
  4. puvit82
    Replies:
    4
    Views:
    743
    puvit82
    Feb 1, 2008
  5. Replies:
    1
    Views:
    1,060
    Martin Honnen
    Sep 26, 2008
Loading...

Share This Page