GNOME Bugzilla – Bug 309205
Wrong line numbers for comments
Last modified: 2009-08-15 18:40:50 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.
Fixed in CVS, thanks, Daniel
This should be closed by release of libxml2-2.6.21, thanks, Daniel