[xml] regular expressions - bug or feature?



Hallo,
I have one question about regular expressions in RELAX NG schema. I have the 
follow schema:

<?xml version="1.0" encoding="utf-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0";
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
  <start>
    <element>
      <name ns="">test</name>
      <data type="string">
        <param name="pattern">test(A{0,4})</param>
      </data>
    </element>
  </start>
</grammar>

So, it would mean that tag 'test' must contain zero or at most four caracters
'A'. Bud libxml2 interprets it as a already one incidence. I tested it with
the follow document:

<?xml version="1.0" encoding="utf-8"?>
<test xmlns="">test</test> 

Bud xmllint return me:

data_test0.xml:2: element test: Relax-NG validity error : Error validating datatype string
data_test0.xml:2: element test: Relax-NG validity error : Element test failed to validate content
data_test0.xml fails to validate

Only if I change test element content to some as a 'A', 'testA'... it works.
If there is no 0 in the regular expression, it works fine to (e.g., A{1,5}...).

Is this some feature of the regular expression in the RELAX NG or it is the
bug? I tested it by xmllint from libxml2 2.6.8


Cheers,
-petrn

-- 

Petr Novak, Liberouter Project (www.liberouter.org)
E-mail: novak merlot ics muni cz




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