mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +03:00
Do normalize string-based datatype value in RelaxNG facet checking
Original patch is from Jan Pokorný <jpokorny redhat com> https://mail.gnome.org/archives/xml/2013-November/msg00028.html Improve it according to reviews and add test files.
This commit is contained in:
committed by
Daniel Veillard
parent
27aae65156
commit
cad102b861
@@ -5315,7 +5315,15 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
|
||||
*/
|
||||
if (value == NULL)
|
||||
return(-1);
|
||||
ret = xmlRegexpExec(facet->regexp, value);
|
||||
/*
|
||||
* If string-derived type, regexp must be tested on the value space of
|
||||
* the datatype.
|
||||
* See https://www.w3.org/TR/xmlschema-2/#rf-pattern
|
||||
*/
|
||||
const int stringType = val && ((val->type >= XML_SCHEMAS_STRING && val->type <= XML_SCHEMAS_NORMSTRING)
|
||||
|| (val->type >= XML_SCHEMAS_TOKEN && val->type <= XML_SCHEMAS_NCNAME));
|
||||
ret = xmlRegexpExec(facet->regexp,
|
||||
(stringType && val->value.str) ? val->value.str : value);
|
||||
if (ret == 1)
|
||||
return(0);
|
||||
if (ret == 0)
|
||||
|
Reference in New Issue
Block a user