GNOME Bugzilla – Bug 726766
libxml2 not ignoring whitespace when validating xsd:int
Last modified: 2021-07-05 13:26:54 UTC
Versions tested and affected: 2.9.1-2 (FC), 2.7.6-14 (CentOS) Given the following schema: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="a" type="xsd:int"/> </xsd:schema> And the following document: <a> 42</a> Xmllint fails to validate this: $ xmllint --schema test_schema.xml test_doc.xml <?xml version="1.0"?> <a> 42</a> test_doc.xml:1: element a: Schemas validity error : Element 'a': ' 42' is not a valid value of the atomic type 'xs:int'. test_doc.xml fails to validate
According to XML Schema Part 2: Datatypes Second Edition, section 4.3.6 all atomic data types other than 'string' have their 'whiteSpace' constraint set to 'collapse', so I think the element 'a' should be valid. There is even a comment to this effect in the libxml2 sources (xmlschemas.c / xmlSchemaTypeFixupWhitespace()): /* * For all `atomic` datatypes other than string (and types `derived` * by `restriction` from it) the value of whiteSpace is fixed to * collapse */
I am getting the same error for version: libxml2-2.9.3-3.fc24.x86_64 this is also my vote to give this one a little more priority ...
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.