diff options
| author | Daniel Veillard <veillard@src.gnome.org> | 2002-09-05 14:21:15 +0000 |
|---|---|---|
| committer | Daniel Veillard <veillard@src.gnome.org> | 2002-09-05 14:21:15 +0000 |
| commit | 76575769f304c80d6d0800b33ec625dd25b6dd49 (patch) | |
| tree | 043aaefc1658a3b7f2f59a3f30dd2c7be4f5c23c /error.c | |
| parent | 3487c8d9bbf0c2d54effc1cd7566c2ececb18752 (diff) | |
| download | android_external_libxml2-76575769f304c80d6d0800b33ec625dd25b6dd49.tar.gz android_external_libxml2-76575769f304c80d6d0800b33ec625dd25b6dd49.tar.bz2 android_external_libxml2-76575769f304c80d6d0800b33ec625dd25b6dd49.zip | |
working on better error reporting of validity errors, especially providing
* error.c valid.c: working on better error reporting of validity
errors, especially providing an accurate context.
* result/valid/xlink.xml.err result/valid/rss.xml.err: better
error reports in those cases.
Daniel
Diffstat (limited to 'error.c')
| -rw-r--r-- | error.c | 33 |
1 files changed, 23 insertions, 10 deletions
@@ -350,22 +350,34 @@ xmlParserValidityError(void *ctx, const char *msg, ...) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserInputPtr input = NULL; char * str; - - if (ctxt != NULL) { - input = ctxt->input; - if ((input->filename == NULL) && (ctxt->inputNr > 1)) - input = ctxt->inputTab[ctxt->inputNr - 2]; - - xmlParserPrintFileInfo(input); + int len = xmlStrlen((const xmlChar *) msg); + static int had_info = 0; + int need_context = 0; + int need_info = 0; + + if ((len > 1) && (msg[len - 2] != ':')) { + if (ctxt != NULL) { + input = ctxt->input; + if ((input->filename == NULL) && (ctxt->inputNr > 1)) + input = ctxt->inputTab[ctxt->inputNr - 2]; + + if (had_info == 0) { + xmlParserPrintFileInfo(input); + } + } + xmlGenericError(xmlGenericErrorContext, "validity error: "); + need_context = 1; + had_info = 0; + } else { + had_info = 1; } - xmlGenericError(xmlGenericErrorContext, "validity error: "); XML_GET_VAR_STR(msg, str); xmlGenericError(xmlGenericErrorContext, "%s", str); if (str != NULL) xmlFree(str); - if (ctxt != NULL) { + if ((ctxt != NULL) && (input != NULL)) { xmlParserPrintFileContext(input); } } @@ -385,8 +397,9 @@ xmlParserValidityWarning(void *ctx, const char *msg, ...) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserInputPtr input = NULL; char * str; + int len = xmlStrlen((const xmlChar *) msg); - if (ctxt != NULL) { + if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) { input = ctxt->input; if ((input->filename == NULL) && (ctxt->inputNr > 1)) input = ctxt->inputTab[ctxt->inputNr - 2]; |
