[xml] "double"s and schema validation



Given this schema file, t.xsd:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
      <xs:element name="t" type="xs:double"/>
    </xs:schema>

And this xml document, t.xml:

    <t>e</t>

I got this:

    $ xmllint --schema t.xsd t.xml
    <?xml version="1.0"?>
    <t>e</t>
    t.xml validates

Note that <t>.</t> and <t>.e</t> also validate.

I tracked it down to xmlschematypes.c, starting around line 2465, where
it starts scanning the input for something suitable for sscanf("%lf").
Should that code contain an extra check that there is at least one digit
somewhere?  I think it comes down to the definition of "decimal" in the
specÂ; the lexical representation arguably allows for such degenerates,
although the canonical representation does not.

So, is this a bug?  I couldn't find a bug or any previous discussion one
way or the other.  If it is a bug, is it in xmlschematypes.c or in the
underlying sscanf implementations?  I get the same results at work
(OpenSolaris) and at home (Debian).

Regards,
Dan

 http://www.w3.org/TR/xmlschema-2/#decimal

-- 
Îá ÎÎá ÏÎáÏ ÎÏÎÎÎÏÏ ÏÎÏÎÏÏÎ -- ÎÏÏÎÎÎÎÎÏ
Do not disturb my circles. -- Archimedes

Dan Sommers, http://www.tombstonezero.net/dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]