1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fixing col information in xmlParserInput and propagating column into xmlError

This commit is contained in:
Aleksey Sanin 2005-01-05 15:37:55 +00:00
parent c74260931b
commit 8fdc32abfe
5 changed files with 27 additions and 17 deletions

View File

@ -1,3 +1,10 @@
Tue Jan 4 17:08:45 PST 2005 Aleksey Sanin <aleksey@aleksey.com>
* parser.c, parserInternal.c: fixed "col" calculation for
struct _xmlParserInput (based on patch from Rob Richards)
* include/libxml/xmlerror.h, error.c: propagated error column
number in the xmlError structure
Tue Jan 4 22:47:22 CET 2005 Daniel Veillard <daniel@veillard.com>
* parser.c: fixed namespace bug in push mode reported by
@ -40,7 +47,7 @@ Tue Jan 4 15:30:15 CET 2005 Daniel Veillard <daniel@veillard.com>
Mon Jan 3 13:57:21 PST 2005 Aleksey Sanin <aleksey@aleksey.com>
* Added GetLineNumber and GetColumnNumber functions for xmlReader
* parser.c: added GetLineNumber and GetColumnNumber functions for xmlReader
Sun Jan 2 17:51:18 HKT 2005 William Brack <wbrack@mmm.com.hk>

View File

@ -429,7 +429,7 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str,
* @str2: extra string info
* @str3: extra string info
* @int1: extra int info
* @int2: extra int info
* @col: column number of the error or 0 if N/A
* @msg: the message to display/transmit
* @...: extra parameters for the message display
*
@ -442,7 +442,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel, void *data, void *ctx,
void *nod, int domain, int code, xmlErrorLevel level,
const char *file, int line, const char *str1,
const char *str2, const char *str3, int int1, int int2,
const char *str2, const char *str3, int int1, int col,
const char *msg, ...)
{
xmlParserCtxtPtr ctxt = NULL;
@ -505,6 +505,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
if (input != NULL) {
file = input->filename;
line = input->line;
col = input->col;
}
}
to = &ctxt->lastError;
@ -571,7 +572,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
if (str3 != NULL)
to->str3 = (char *) xmlStrdup((const xmlChar *) str3);
to->int1 = int1;
to->int2 = int2;
to->int2 = col;
to->node = node;
to->ctxt = ctx;

View File

@ -82,7 +82,7 @@ struct _xmlError {
char *str2; /* extra string information */
char *str3; /* extra string information */
int int1; /* extra number information */
int int2; /* extra number information */
int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */
void *ctxt; /* the parser context if available */
void *node; /* the node in the tree */
};
@ -889,7 +889,7 @@ XMLPUBFUN void XMLCALL
const char *str2,
const char *str3,
int int1,
int int2,
int col,
const char *msg,
...);
XMLPUBFUN void XMLCALL

View File

@ -2421,6 +2421,7 @@ xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) {
while (*in != 0 && *in == *cmp) {
++in;
++cmp;
ctxt->input->col++;
}
if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {
/* success */
@ -3201,10 +3202,10 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
get_more_space:
while (*in == 0x20) in++;
if (*in == 0xA) {
ctxt->input->line++;
ctxt->input->line++; ctxt->input->col = 1;
in++;
while (*in == 0xA) {
ctxt->input->line++;
ctxt->input->line++; ctxt->input->col = 1;
in++;
}
goto get_more_space;
@ -3237,13 +3238,15 @@ get_more:
((*in > '&') && (*in < '<')) ||
((*in > '<') && (*in < ']')) ||
((*in >= 0x20) && (*in < '&')) ||
(*in == 0x09))
in++;
(*in == 0x09)) {
in++;
ctxt->input->col++;
}
if (*in == 0xA) {
ctxt->input->line++;
ctxt->input->line++; ctxt->input->col = 1;
in++;
while (*in == 0xA) {
ctxt->input->line++;
ctxt->input->line++; ctxt->input->col = 1;
in++;
}
goto get_more;
@ -3255,6 +3258,7 @@ get_more:
return;
}
in++;
ctxt->input->col++;
goto get_more;
}
nbchar = in - ctxt->input->cur;
@ -3288,7 +3292,7 @@ get_more:
if (*in == 0xA) {
ctxt->input->cur = in;
in++;
ctxt->input->line++;
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
}
in--;

View File

@ -473,8 +473,7 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
* the single character #xA.
*/
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++;
ctxt->input->col = 1;
ctxt->input->line++; ctxt->input->col = 1;
} else
ctxt->input->col++;
@ -551,8 +550,7 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
*/
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++;
ctxt->input->col = 1;
ctxt->input->line++; ctxt->input->col = 1;
} else
ctxt->input->col++;
ctxt->input->cur++;