Re: [xml] validating SAX parser and error line numbers

Thus spake Joel Uckelman:
2) If after a call to xmlParseDocument(), I find that !ctx->wellFormed,
is there a way to get an accurate indication of where things went wrong?
As with my example above, if I have "<blerg" on line 12 and call
xmlParseDocument(), after that the ctx->input->line is one more than the
last line of input---i.e., it appears that the parser read to the end in
a desparate attempt to find a closing '>'.

I'm still hunting for a good solution for #2. The best idea I've had
so far is for each SAX callback to update a variable containing the
line number at the time it's run. This way, that variable (call it
"goodline") will contain the number of the last line on which anything
was successfully processed. I would think that libxml must already have
this information, if only I knew where to look for it.

Does libxml2 not support this kind of thing? Anyone?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]