false negative validation: error '1835': 0.04 must be greater than 0
Hello,
i use libxml2 to validate an xml file against a xsd schema and face this issue:
As you can see the error message is simply wrong. 0.04 is obvious greater than 0. Using xmllint from terminal with the exact same xml and xsd file does not find any issues with the validation. Howerever, using libxml2 within my c++ code does.
As a work around it is possible to change the type float to decimal in the xsd file. But this is not an option for me as the xsd is part of an bigger project where the xsd is autogenerated and also used for code generation. Changing float to decimal would come with hugh extra work.
Here is the xml file
<tns:Root xmlns:tns="XXX" xmlns:xsi="XXX">
<Class id="1">
<Value>0.04</Value>
</Class>
</tns:Root>
and here is the xsdfile:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="XXX" xmlns:p="XXX" xmlns:p1="XXX" targetNamespace="XXX">
<element name="Root">
<complexType>
<sequence>
<element name="Class" type="tns:ClassType" maxOccurs="unbounded" minOccurs="0">
<annotation>
<documentation/>
</annotation>
</element>
</sequence>
</complexType>
</element>
<complexType name="ClassType">
<sequence>
<element name="Value" minOccurs="0" maxOccurs="1">
<annotation>
<documentation>blabla</documentation>
<appinfo>
<p:default>0.040</p:default>
</appinfo>
</annotation>
<simpleType>
<restriction base="float">
<minExclusive value="0"/>
<maxExclusive value="1"/>
</restriction>
</simpleType>
</element>
</sequence>
<attribute name="id" type="int" use="required"/>
</complexType>
</schema>
my c++ code using libxml2 is here:
Is this an issue of libxml2 or is the issue with my code?
i use libxml2.9.13 but also build from source version 2.12.13 the issue is with both versions.