diff options
author | Juergen Keil <jrgn.keil@googlemail.com> | 2014-08-07 11:42:07 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2014-08-07 11:42:07 +0800 |
commit | d201e71ed0df1dce7aca232f81a1c3e2eee8be73 (patch) | |
tree | 71546f5033a63f40166711c2c6963dc96a9804e3 | |
parent | 658b86c0eaacefb0999873efb883c7e50c628d18 (diff) | |
download | libxml2-d201e71ed0df1dce7aca232f81a1c3e2eee8be73.tar.gz |
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.
-rw-r--r-- | xmlschemas.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |