[libxml2] no error column in structured error handler for xml schema validation errors
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] no error column in structured error handler for xml schema validation errors
- Date: Thu, 7 Aug 2014 03:43:07 +0000 (UTC)
commit d201e71ed0df1dce7aca232f81a1c3e2eee8be73
Author: Juergen Keil <jrgn keil googlemail com>
Date: Thu Aug 7 11:42:07 2014 +0800
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 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/xmlschemas.c b/xmlschemas.c
index 462bc37..0657b66 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]