Re: [xml] [Patch] Provide two more schema validation messages



Hi again Daniel & Kasimier,

The attached trivial patch provides the 4 remaining XML Schema validation messages, assuming that an equivalent message for the whitespace facet type isn't required. Apologies for not getting these to you in time for the 2.6.19 release.

I think the wording for minExclusive and maxExclusive is accurate, though my head's starting to hurt after trying to think of the best way to phrase such a seemingly simple statement!

Regards,

Matt.
diff -Naur libxml2-2.6.19.orig/xmlschemas.c libxml2-2.6.19/xmlschemas.c
--- libxml2-2.6.19.orig/xmlschemas.c    2005-04-01 15:19:53.000000000 +0000
+++ libxml2-2.6.19/xmlschemas.c 2005-04-04 19:46:57.000000000 +0000
@@ -1684,18 +1684,26 @@
                "maximum value allowed ('%s').\n");
            xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
                facet->value);
-#if 0
        } else if (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE) {
-           msg = xmlStrcat(msg, BAD_CAST "The value '%s' is less than the "
-               "minimum exclusive value allowed ('%s').\n");
+           msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be less than "
+               "'%s'.\n");
            xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
                facet->value);
        } else if (facetType == XML_SCHEMA_FACET_MAXEXCLUSIVE) {
-           msg = xmlStrcat(msg, BAD_CAST "The value '%s' is greater than the "
-               "maximum exclusive value allowed ('%s').\n");
+           msg = xmlStrcat(msg, BAD_CAST "The value '%s' must be more than "
+               "'%s'.\n");
            xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
                facet->value);
-#endif
+       } else if (facetType == XML_SCHEMA_FACET_TOTALDIGITS) {
+               msg = xmlStrcat(msg, BAD_CAST "The value '%s' has more "
+               "digits than are allowed ('%s').\n");
+               xmlSchemaVErr(ctxt, node, error, (const char*) msg, value,
+               facet->value);
+       } else if (facetType == XML_SCHEMA_FACET_FRACTIONDIGITS) {
+               msg = xmlStrcat(msg, BAD_CAST "The value '%s' has more fractional "
+               "digits than are allowed ('%s').\n");
+               xmlSchemaVErr(ctxt, node, error, (const char*) msg, value,
+               facet->value);
        } else if (node->type == XML_ATTRIBUTE_NODE) {          
            msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n");
            xmlSchemaVErr(ctxt, node, error, (const char *) msg, value, NULL);


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