Re: [xml] "double"s and schema validation



On 20 July 2010 02:40, Dan Sommers <dan tombstonezero net> wrote:
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

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

As 'e' is an optional part of a double, can you try a different value.
Something like 'FooBar'. Anything really.



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