UweSchmidt / hxt

Haskell XML Toolbox
http://www.fh-wedel.de/~si/HXmlToolbox/index.html
124 stars 35 forks source link

XML schema data types in hxt-relaxng don't support constants #64

Open blamario opened 7 years ago

blamario commented 7 years ago

Take this schema and call it integer.rng:

<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <choice>
      <element name="test1">
        <data type="integer" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"/>
      </element>
      <element name="test2">
        <value type="integer" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">4</value>
      </element>
    </choice>
  </start>
</grammar>

The instance <test1>4</test1> validates perfectly, while equally valid <test2>4</test2> doesn't.

blamario commented 7 years ago

The problem appears to be in function datatypeEqualW3C in module DataTypeLibW3C. The data-type map norm in there is either used in a wrong way, or it should map all missing entries to id like it does for string.