[oXygen-user] wrong conjunction for multiple pattern facets?

Syd Bauman
Wed Dec 27 16:43:53 CST 2006


[This may be a FAQ, in which case I apologize in advance. I have
 searched the list archives, but not the forums, for postings related
 to this issue.]

It seems that oXygen's XML validator does not know how to properly
apply multiple 'pattern' facets when validating against a RelaxNG
grammar. 

To my knowledge, multiple occurrences of a 'pattern' facet are
allowed on xsd: datatypes; the content in the instance should match
all of the patterns specified in order to be considered valid.
      When several <param> elements are included, all
      the constraints must be met (in other words, the
      result is a logical "and" of all the conditions).
      Also note that the same facet can't be repeated
      twice except for the facet named 'pattern'.
      -- van der Vlist, Eric. _RELAX_NG_, Ch 8 sect.
         "Facets", p. 93

However, oXygen's internal validator (xerces, right?) seems to use
"or" instead of "and". Here is a test.

--------- begin t.rnc ---------
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
start =
  element test {
    element alpha {
      xsd:token {
         pattern = "a{1,9}B{3}c"
         pattern = "a{3}B{1,9}c"
         maxLength = "25"
      }
    }+
  }
--------- end t.rnc ---------

--------- begin t.xml ---------
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="file:/private/tmp/t.rnc" type="compact"?>
<test>
  <alpha>aaaBBBc</alpha>
  <alpha>aBBBc</alpha>
  <alpha>aaaBc</alpha>
</test>
--------- end t.xml ---------

I expect the above file to be invalid: line 6 fails to match the
first xsd pattern in the schema and line 5 fails to match the second.
I expect line 4 to be valid.

I ran xmllint, jing, and rnv on the command-line, and they all flag
lines 5 & 6 as invalid (i.e., they agree with me.) I don't know how
to run xerces from the command-line. (Feel free to tell me ... :-)

But oXygen says t.xml is valid (both the "live" validation that
occurs while I type and the "static" validation that occurs with
CMD-shift-V say it is valid).




More information about the oXygen-user mailing list