Commit 2be30641 authored by Daniel Veillard's avatar 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
Daniel
parent 50582114
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>
* parser.c: fixed line number reporting on error
......
......@@ -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);
}
/**
......
./test/VC/PENesting:1: error: xmlParseStartTag: invalid element name
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^
^
./test/VC/PENesting:1: error: Extra content at the end of the document
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^
^
./test/VC/PENesting2:1: error: xmlParseStartTag: invalid element name
<!ENTITY % p1 "(A|B">
^
^
./test/VC/PENesting2:1: error: Extra content at the end of the document
<!ENTITY % p1 "(A|B">
^
^
test/VC/dtds/a.dtd:1: validity error: Redefinition of element a
<!ELEMENT a (#PCDATA | b | c)*>
^
^
./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
^
./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"
^
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment