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

George Cristian Bina
Wed Dec 27 17:17:05 CST 2006


Hi Syd,

In XML Schema the matching should be done against any of the pattern 
facets specified for a specific type, see
http://www.w3.org/TR/xmlschema-2/#src-multiple-patterns
***
·pattern· facets specified on the same step in a type derivation are 
ORed together
***

oXygen 8 uses oNVDL for Relax NG validation, oNVDL changes Jing to add 
along with NVDL support also a couple of fixes, one of this fixes is to 
handle properly the pattern facet, that is why you obtain a different 
behavior if you use Jing
http://www.oxygenxml.com/onvdl
***
This version of oNVDL is based on Jing version 20030619 and changes Jing 
as follows:
[...]
Handles correctly the XML Schema pattern facet by checking against any 
of the patterns.
***

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Syd Bauman wrote:
> [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).
> 
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user




More information about the oXygen-user mailing list