1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

- error.c: applied the context output patch of the error

handling submitted by Chuck Griffith
- error/VC/*: this slightly change some error logs
Daniel
This commit is contained in:
Daniel Veillard
2001-03-27 00:32:28 +00:00
parent 505821145f
commit 2be30641d1
6 changed files with 33 additions and 17 deletions

View File

@ -1,3 +1,9 @@
Tue Mar 27 02:30:23 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* 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 <Daniel.Veillard@imag.fr> Tue Mar 27 00:51:27 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* parser.c: fixed line number reporting on error * parser.c: fixed line number reporting on error

30
error.c
View File

@ -107,34 +107,44 @@ void
xmlParserPrintFileContext(xmlParserInputPtr input) { xmlParserPrintFileContext(xmlParserInputPtr input) {
const xmlChar *cur, *base; const xmlChar *cur, *base;
int n; int n;
xmlChar content[81];
xmlChar *ctnt;
if (input == NULL) return; if (input == NULL) return;
cur = input->cur; cur = input->cur;
base = input->base; base = input->base;
/* skip backwards over any end-of-lines */
while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) { while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
cur--; cur--;
} }
n = 0; n = 0;
/* search backwards for beginning-of-line maximum 80 characters */
while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r')) while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
cur--; cur--;
if ((*cur == '\n') || (*cur == '\r')) cur++; if ((*cur == '\n') || (*cur == '\r')) cur++;
base = cur; /* search forward for end-of-line maximum 80 characters */
n = 0; n = 0;
ctnt = content;
while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) { while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
xmlGenericError(xmlGenericErrorContext, *ctnt++ = *cur++;
"%c", (unsigned char) *cur++);
n++; n++;
} }
xmlGenericError(xmlGenericErrorContext, "\n"); *ctnt = 0;
xmlGenericError(xmlGenericErrorContext,"%s\n", content);
/* create blank line with problem pointer */
cur = input->cur; cur = input->cur;
while ((*cur == '\n') || (*cur == '\r')) while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
cur--; cur--;
}
n = 0; n = 0;
while ((cur != base) && (n++ < 80)) { ctnt = content;
xmlGenericError(xmlGenericErrorContext, " "); while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) {
base++; *ctnt++ = ' ';
cur--;
} }
xmlGenericError(xmlGenericErrorContext,"^\n"); *(--ctnt) = '^';
*(++ctnt) = 0;
xmlGenericError(xmlGenericErrorContext,"%s\n", content);
} }
/** /**

View File

@ -1,6 +1,6 @@
./test/VC/PENesting:1: error: xmlParseStartTag: invalid element name ./test/VC/PENesting:1: error: xmlParseStartTag: invalid element name
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>"> <!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^ ^
./test/VC/PENesting:1: error: Extra content at the end of the document ./test/VC/PENesting:1: error: Extra content at the end of the document
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>"> <!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^ ^

View File

@ -1,6 +1,6 @@
./test/VC/PENesting2:1: error: xmlParseStartTag: invalid element name ./test/VC/PENesting2:1: error: xmlParseStartTag: invalid element name
<!ENTITY % p1 "(A|B"> <!ENTITY % p1 "(A|B">
^ ^
./test/VC/PENesting2:1: error: Extra content at the end of the document ./test/VC/PENesting2:1: error: Extra content at the end of the document
<!ENTITY % p1 "(A|B"> <!ENTITY % p1 "(A|B">
^ ^

View File

@ -1,3 +1,3 @@
test/VC/dtds/a.dtd:1: validity error: Redefinition of element a test/VC/dtds/a.dtd:1: validity error: Redefinition of element a
<!ELEMENT a (#PCDATA | b | c)*> <!ELEMENT a (#PCDATA | b | c)*>
^ ^

View File

@ -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
<p><termdef id="dt-arc" term="Arc">An <term>arc</term> is contained within an <p><termdef id="dt-arc" term="Arc">An <term>arc</term> 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"
^ ^