I have a problem validating a perfectly valid XML with it's schema file in Ruby. It works OK on my development machine (OS X 10.6) but fails everytime on the production system (Debian 4.1).
The part of the XML that gives errors is this:
<ROUNDINGS>-0.02</ROUNDINGS>
And the XSD pattern is this:
<xsd:element name="ROUNDINGS">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="([+-]?(\d{0,1}\.\d{0,2})|[ ])*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Command run (nokogiri):
Nokogiri::XML::Schema(File.read("schema.xsd")).validate(Nokogiri::XML(File.read("roundings.xml")))
and error output:
[#<Nokogiri::XML::SyntaxError: Element 'ROUNDINGS': [facet 'pattern'] The value '-0.02' is not accepted by the pattern '([+-]?(\d{0,1}\.\d{0,2})|[ ])*'.>, #<Nokogiri::XML::SyntaxError: Element 'ROUNDINGS': '-0.02' is not a valid value of the local atomic type.>]
Command run (libxml-ruby):
XML::Document.file("roundings.xml").validate_schema(XML::Schema.from_string(File.read("schema.xsd")))
and error output:
Error: Element 'ROUNDINGS': [facet 'pattern'] The value '-0.02' is not accepted by the pattern '([+-]?(\d{0,1}\.\d{0,2})|[ ])*'. at roundings.xml:232.
Error: Element 'ROUNDINGS': '-0.02' is not a valid value of the local atomic type. at roundings.xml:232.
I'm using libxml-ruby 1.1.3 and nokogiri 1.4.3.1 on Ruby 1.8.6
As the problem is the same for both libraries, it seems that the validation is done using some system library that has a problem?