[xml] [PATCH] Fix "token" datatype into account in RelaxNG patterns



$ cat small.rng
<grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";
         xmlns="http://relaxng.org/ns/structure/1.0";>

<start>
    <element name="script">
          <attribute name="file">
              <data type="token">
                  <except>
                      <data type="token">
                          <param name="pattern">/etc/(rc\.d/)?init\.d/cman</param>
                      </data>
                  </except>
              </data>
          </attribute>
    </element>
</start>

</grammar>

---

$ cat testcase.xml
<script file=" /etc/rc.d/init.d/cman "/>

---

before (bug in question present):

$ xmllint --noout --relaxng small.rng testcase.xml
testcase.xml validates

desired (hopefully, this is not a false assumption, this is also
         the behavior of jing or xmllint when the attribute value
         is whitespace-normalized manually):

$ xmllint --noout --relaxng small.rng testcase.xml
testcase.xml fails to validate

---

The patch fixes the issue, but I must admit it's more like the easiest
solution I was able to achieve, not necessarily a proper one (also
considering the various contexts the affected code can be run in).

Generally, it seems that some relevant parts of the code are affected
by some change trying to be backwards compatible;
from xmlSchemaValidateFacetWhtsp (the originally used function?):

Note that @value needs to be the *normalized* value if the facet
is of type "pattern".

Please let me know if I can help somehow to get the test case passing.
If agreed, I will also turn it to the proper part of the test suite.

And yes, test suite still passes.

Jan Pokorný (1):
  Do normalize token datatype value in RelaxNG facet checking

 xmlschemastypes.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
1.8.1.4



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