1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-11 12:58:16 +03:00

no error column in structured error handler for xml schema validation errors

For https://bugzilla.gnome.org/show_bug.cgi?id=734363

When using xml schema validation, structured error callbacks do not get
passed a valid column number in xmlError field "int2".

$ ./xmlsaxparse colbug5.xml colbug5.xsd
colbug5.xml:3:0: Element '{urn:colbug5}bx': This element is not
expected.
Expected is ( {urn:colbug5}b ).

The schema error is reported for line 3, column 0 (= N/A).

I'd like to have the column number of the error passed in the xmlError
structure.  With this test case: line 3, column 9.
This commit is contained in:
Juergen Keil 2014-08-07 11:42:07 +08:00 committed by Daniel Veillard
parent 658b86c0ea
commit d201e71ed0

View File

@ -2039,6 +2039,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
const char *file = NULL;
int col = 0;
if (errorLevel != XML_ERR_WARNING) {
vctxt->nberrors++;
vctxt->err = error;
@ -2067,6 +2068,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
(vctxt->parserCtxt->input != NULL)) {
file = vctxt->parserCtxt->input->filename;
line = vctxt->parserCtxt->input->line;
col = vctxt->parserCtxt->input->col;
}
} else {
/*
@ -2101,7 +2103,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
node, XML_FROM_SCHEMASV,
error, errorLevel, file, line,
(const char *) str1, (const char *) str2,
(const char *) str3, 0, 0, msg, str1, str2, str3, str4);
(const char *) str3, 0, col, msg, str1, str2, str3, str4);
} else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) {
xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt;