Re: [xml] xmlGetLineNo() always returns 0 for XML_TEXT_NODE
- From: Daniel Veillard <veillard redhat com>
- To: Ralf Junker <ralfjunker gmx de>
- Cc: xml gnome org
- Subject: Re: [xml] xmlGetLineNo() always returns 0 for XML_TEXT_NODE
- Date: Wed, 9 Jul 2008 10:47:26 -0400
On Wed, Jul 09, 2008 at 03:17:59PM +0200, Ralf Junker wrote:
At 13:39 07.07.2008, Daniel Veillard wrote:
can you check the enclosed patch fixes it for you ?
I checked some more and noticed that your patch suggests
if (ctxt->input != NULL)
ret->line = ctxt->input->line;
where similar assignments in SAX2.c use
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
else
ret->line = 65535;
Shouldn't the fix be just like this, especially because it
takes care not to overflow ret->line ?
yes that's true. I also notice a problem with the current patch,
if the text node is 10 lines longs, you will set the line number to
the one after the last character of the text node.
So that patch looks wrong to me. Usually a text node is a children
of an element or attribute, I don't think we can get the precise line
for an attribute (or its text) due to the SAX callback limitation
and in that case the best is to use the element line number. if it's the
child of an element, it's harder ...
I don't have a good solution the problem is that SAX carries no
line informations, I guess one need more thinking about it, I guess
ctxt will have to be augmented to keep a line number for the start of
the next node. Anything else will be unreliable.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]