html5lib / gcode-import

Automatically exported from code.google.com/p/html5lib. Purely archival.
Other
7 stars 8 forks source link

HTMLParser with the lxml TreeBuilder throws 'non-void-element-with-trailing-solidus' for <meta ... /> #160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

import html5lib
from html5lib import treebuilders
from lxml import etree

parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder("lxml"), 
strict=True, namespaceHTMLElements=False)

try:
    etree_document = parser.parse('<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head><body></body></html>')
except Exception:
    # This will output the first error
    line = str(parser.errors[0][0][0])
    error = parser.errors[0][1]
    element = parser.errors[0][2]['name']

    # The html5lib module seems to think that the <meta> tag is non-void when in fact it is:
    raise Exception, "/dashboard/ is NOT valid HTML5: " + error + ", Element: " + element + " Line: " + line

What is the expected output? What do you see instead?

I expect no exception, but I get an exception.

Please provide any additional information below.

Original issue reported on code.google.com by kynan.st...@gmail.com on 10 Sep 2010 at 2:51

GoogleCodeExporter commented 9 years ago
I get this using the defaults:

html5lib.HTMLParser()

parser.errors returns (for my line numbering):
((4, 68), 'non-void-element-with-trailing-solidus', {'name': u'meta'})

Original comment by eric.pro...@gmail.com on 24 Feb 2011 at 1:10

GoogleCodeExporter commented 9 years ago
I can't reproduce any more.

Original comment by ja...@hoppipolla.co.uk on 13 Mar 2011 at 5:55