Hackfut Security File Manager
Current Path:
/usr/lib64/python2.6/site-packages/lxml/html
usr
/
lib64
/
python2.6
/
site-packages
/
lxml
/
html
/
📁
..
📄
ElementSoup.py
(319 B)
📄
ElementSoup.pyc
(622 B)
📄
ElementSoup.pyo
(622 B)
📄
__init__.py
(50.92 KB)
📄
__init__.pyc
(55.04 KB)
📄
__init__.pyo
(54.79 KB)
📄
_dictmixin.py
(3.46 KB)
📄
_dictmixin.pyc
(4.58 KB)
📄
_dictmixin.pyo
(4.58 KB)
📄
_diffcommand.py
(2.03 KB)
📄
_diffcommand.pyc
(2.79 KB)
📄
_diffcommand.pyo
(2.79 KB)
📄
_html5builder.py
(3.05 KB)
📄
_html5builder.pyc
(4.39 KB)
📄
_html5builder.pyo
(4.39 KB)
📄
_setmixin.py
(2.43 KB)
📄
_setmixin.pyc
(5.07 KB)
📄
_setmixin.pyo
(5.07 KB)
📄
builder.py
(4.21 KB)
📄
builder.pyc
(3.83 KB)
📄
builder.pyo
(3.83 KB)
📄
clean.py
(24.43 KB)
📄
clean.pyc
(18.46 KB)
📄
clean.pyo
(18.36 KB)
📄
defs.py
(3.71 KB)
📄
defs.pyc
(3.49 KB)
📄
defs.pyo
(3.49 KB)
📄
diff.py
(29.66 KB)
📄
diff.pyc
(28.02 KB)
📄
diff.pyo
(27.68 KB)
📄
formfill.py
(9.53 KB)
📄
formfill.pyc
(9.78 KB)
📄
formfill.pyo
(9.53 KB)
📄
html5parser.py
(5.18 KB)
📄
html5parser.pyc
(5.73 KB)
📄
html5parser.pyo
(5.73 KB)
📄
soupparser.py
(4.17 KB)
📄
soupparser.pyc
(4.72 KB)
📄
soupparser.pyo
(4.72 KB)
📄
usedoctest.py
(249 B)
📄
usedoctest.pyc
(464 B)
📄
usedoctest.pyo
(464 B)
Editing: _html5builder.py
""" This module implements a tree builder for html5lib that generates lxml html element trees. This module uses camelCase as it follows the html5lib style guide. """ from html5lib.treebuilders import _base, etree as etree_builders from lxml import html, etree class DocumentType(object): def __init__(self, name, publicId, systemId): self.name = name self.publicId = publicId self.systemId = systemId class Document(object): def __init__(self): self._elementTree = None self.childNodes = [] def appendChild(self, element): self._elementTree.getroot().addnext(element._element) class TreeBuilder(_base.TreeBuilder): documentClass = Document doctypeClass = DocumentType elementClass = None commentClass = None fragmentClass = Document def __init__(self): html_builder = etree_builders.getETreeModule(html, fullTree=False) etree_builder = etree_builders.getETreeModule(etree, fullTree=False) self.elementClass = html_builder.Element self.commentClass = etree_builder.Comment _base.TreeBuilder.__init__(self) def reset(self): _base.TreeBuilder.reset(self) self.rootInserted = False self.initialComments = [] self.doctype = None def getDocument(self): return self.document._elementTree def getFragment(self): fragment = [] element = self.openElements[0]._element if element.text: fragment.append(element.text) fragment.extend(element.getchildren()) if element.tail: fragment.append(element.tail) return fragment def insertDoctype(self, name, publicId, systemId): doctype = self.doctypeClass(name, publicId, systemId) self.doctype = doctype def insertComment(self, data, parent=None): if not self.rootInserted: self.initialComments.append(data) else: _base.TreeBuilder.insertComment(self, data, parent) def insertRoot(self, name): buf = [] if self.doctype and self.doctype.name: buf.append('<!DOCTYPE %s' % self.doctype.name) if self.doctype.publicId is not None or self.doctype.systemId is not None: buf.append(' PUBLIC "%s" "%s"' % (self.doctype.publicId, self.doctype.systemId)) buf.append('>') buf.append('<html></html>') root = html.fromstring(u''.join(buf)) # Append the initial comments: for comment in self.initialComments: root.addprevious(etree.Comment(comment)) # Create the root document and add the ElementTree to it self.document = self.documentClass() self.document._elementTree = root.getroottree() # Add the root element to the internal child/open data structures root_element = self.elementClass(name) root_element._element = root self.document.childNodes.append(root_element) self.openElements.append(root_element) self.rootInserted = True
Upload File
Create Folder