Re: [xml] Pattern contstraints in XML Schema (escaping period in character groups)



Hi All,

Does anyone have any input on this?  I've used several other regular _expression_ engines, and they treat '.' within a character group as representing a literal '.' character, not "all characters".

The XML Schema specification states (http://www.w3.org/TR/xmlschema-2/#nt-posCharGroup) that a posCharGroup is:

[14]    posCharGroup    ::=    ( charRange | charClassEsc )+

'.' is a valid charRange.  Shouldn't it be considered a charRange rather than a charClassEsc since it matches on charRange and the rest of the posCharGroup parses successfully?

Regards,

Andrew

Andrew Tosh wrote:
Hi All,

I am using libxml2's regular _expression_ engine to validate XML Schema instances against pattern constraints.

I have run into a situation where either the W3C specification seems ambiguous, or libxml2 is doing something wrong.  My schema has a pattern constraint "[^.:/]+", meaning one or more characters which is not a period, colon, or slash.  XSV validates the attached document, but libxml2 considers '.' to represent the multi-character escape for all characters except newline.

http://www.w3.org/TR/2000/WD-xmlschema-2-20000407/#dt-poschargroup defines the meaning of a character group in an XML Schema regular _expression_.  The '.' character is both a member of R (defined as any XML character that is not '[', ']', or '\' and that doesn't create a range) and E, where it represents any character.  I would think R appearing before E in the table means an application should try and match against the rules for R first, and that '.' should not have to be escaped within a character group.

Please let me know what you think, and if there is some consensus, I will submit a patch.

Regards,

Andrew


<?xml version="1.0" encoding="utf-8"?> <testElem xmlns="http://obj-sys.com/mySchema">value</testElem>

_______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml gnome org http://mail.gnome.org/mailman/listinfo/xml

-- 
Andrew Tosh
Objective Systems, Inc.
REAL WORLD ASN.1 AND XML SOLUTIONS
Tel: +1 (484) 875-9841
Fax: +1 (484) 875-9830
Toll-free: (877) 307-6855 (USA only)
http://www.obj-sys.com 


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