From d201e71ed0df1dce7aca232f81a1c3e2eee8be73 Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Thu, 7 Aug 2014 11:42:07 +0800 Subject: [PATCH] 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. --- xmlschemas.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xmlschemas.c b/xmlschemas.c index 462bc37c..0657b66a 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -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;