diff --git a/ChangeLog b/ChangeLog index e61f2605..3a7032e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Mar 27 02:30:23 CEST 2001 Daniel Veillard + + * error.c: applied the context output patch of the error + handling submitted by Chuck Griffith + * error/VC/*: this slightly change some error logs + Tue Mar 27 00:51:27 CEST 2001 Daniel Veillard * parser.c: fixed line number reporting on error diff --git a/error.c b/error.c index a0124d43..b8aaf1be 100644 --- a/error.c +++ b/error.c @@ -107,34 +107,44 @@ void xmlParserPrintFileContext(xmlParserInputPtr input) { const xmlChar *cur, *base; int n; + xmlChar content[81]; + xmlChar *ctnt; if (input == NULL) return; cur = input->cur; base = input->base; + /* skip backwards over any end-of-lines */ while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) { cur--; } n = 0; + /* search backwards for beginning-of-line maximum 80 characters */ while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r')) cur--; if ((*cur == '\n') || (*cur == '\r')) cur++; - base = cur; + /* search forward for end-of-line maximum 80 characters */ n = 0; + ctnt = content; while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) { - xmlGenericError(xmlGenericErrorContext, - "%c", (unsigned char) *cur++); + *ctnt++ = *cur++; n++; } - xmlGenericError(xmlGenericErrorContext, "\n"); + *ctnt = 0; + xmlGenericError(xmlGenericErrorContext,"%s\n", content); + /* create blank line with problem pointer */ cur = input->cur; - while ((*cur == '\n') || (*cur == '\r')) - cur--; + while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) { + cur--; + } n = 0; - while ((cur != base) && (n++ < 80)) { - xmlGenericError(xmlGenericErrorContext, " "); - base++; + ctnt = content; + while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) { + *ctnt++ = ' '; + cur--; } - xmlGenericError(xmlGenericErrorContext,"^\n"); + *(--ctnt) = '^'; + *(++ctnt) = 0; + xmlGenericError(xmlGenericErrorContext,"%s\n", content); } /** diff --git a/result/VC/PENesting b/result/VC/PENesting index 28a09962..3d46fba2 100644 --- a/result/VC/PENesting +++ b/result/VC/PENesting @@ -1,6 +1,6 @@ ./test/VC/PENesting:1: error: xmlParseStartTag: invalid element name "> - ^ +^ ./test/VC/PENesting:1: error: Extra content at the end of the document "> - ^ +^ diff --git a/result/VC/PENesting2 b/result/VC/PENesting2 index 5162e40b..14e34202 100644 --- a/result/VC/PENesting2 +++ b/result/VC/PENesting2 @@ -1,6 +1,6 @@ ./test/VC/PENesting2:1: error: xmlParseStartTag: invalid element name - ^ +^ ./test/VC/PENesting2:1: error: Extra content at the end of the document - ^ +^ diff --git a/result/VC/UniqueElementTypeDeclaration b/result/VC/UniqueElementTypeDeclaration index d2ff38bc..a2656c82 100644 --- a/result/VC/UniqueElementTypeDeclaration +++ b/result/VC/UniqueElementTypeDeclaration @@ -1,3 +1,3 @@ test/VC/dtds/a.dtd:1: validity error: Redefinition of element a - ^ + ^ diff --git a/result/valid/xlink.xml.err b/result/valid/xlink.xml.err index c1358cda..48c3b0cb 100644 --- a/result/valid/xlink.xml.err +++ b/result/valid/xlink.xml.err @@ -1,6 +1,6 @@ -./test/valid/xlink.xml:816: validity error: ID dt-arc already defined +./test/valid/xlink.xml:450: validity error: ID dt-arc already defined

An arc is contained within an ^ -./test/valid/xlink.xml:956: validity error: IDREF attribute def reference an unknown ID "dt-xlg" +./test/valid/xlink.xml:530: validity error: IDREF attribute def reference an unknown ID "dt-xlg" ^