[xml] [PATCH] HTML Parser does not keep track of line numbers



Hello,

The HTML parser does not keep track of line numbers.  If you parse an
HTML file, search for any non-text node, then get the line number from
the node, it will always return 0.

I've created a file to reproduce the problem, along with a patch to
libxml2 to fix it:

http://gist.github.com/103637

Also, I've filed a bug in bugzilla here:

http://bugzilla.gnome.org/show_bug.cgi?id=580705

Here is the patch (again):

diff --git a/HTMLparser.c b/HTMLparser.c
index 24b0fc0..de497eb 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -5652,6 +5652,7 @@ htmlSAXParseFile(const char *filename, const char *encodin
     xmlInitParser();

     ctxt = htmlCreateFileParserCtxt(filename, encoding);
+    ctxt->linenumbers = 1;
     if (ctxt == NULL) return(NULL);
     if (sax != NULL) {
        oldsax = ctxt->sax;

-- 
Aaron Patterson
http://tenderlovemaking.com/



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