After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309205 - Wrong line numbers for comments
Wrong line numbers for comments
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.19
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-06-30 13:13 UTC by Walter Dörwald
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Walter Dörwald 2005-06-30 13:13:18 UTC
Distribution/Version: Debian 3.1

It seems that for comments without interleaved elements the line number doesn't
get updated properly. The following Python script demonstrates the problem:
-----
import libxml2

libxml2.lineNumbersDefault(1)

def do(s):
   print repr(s)
   doc = libxml2.htmlReadMemory(s, len(s), "foo", "iso-8859-1", 0x60)

   node = doc.children.next.children.children
   while node is not None:
      print node.type, node.content, node.lineNo()
      node = node.next

s = "<html><body>%s</body></html>"
do(s % "".join("<p>foo%d</p>\n" % i for i in xrange(3)))
do(s % "".join("<!--foo%d-->\n" % i for i in xrange(3)))
-----
The output is:
-----
'<html><body><p>foo0</p>\n<p>foo1</p>\n<p>foo2</p>\n</body></html>'
element foo0 1
element foo1 2
element foo2 3
'<html><body><!--foo0-->\n<!--foo1-->\n<!--foo2-->\n</body></html>'
comment foo0 1
comment foo1 1
comment foo2 1
-----
I would have expected it to be:
-----
'<html><body><p>foo0</p>\n<p>foo1</p>\n<p>foo2</p>\n</body></html>'
element foo0 1
element foo1 2
element foo2 3
'<html><body><!--foo0-->\n<!--foo1-->\n<!--foo2-->\n</body></html>'
comment foo0 1
comment foo1 2
comment foo2 3
-----
This happens on Debian 3.1 with manually compiled Python 2.4.1 and libxml2 2.6.19.
Comment 1 Daniel Veillard 2005-08-24 14:05:57 UTC
Fixed in CVS,

thanks,

Daniel
Comment 2 Daniel Veillard 2005-09-05 08:58:53 UTC
This should be closed by release of libxml2-2.6.21,

  thanks,

Daniel