Ignore Comment Nodes
This commit is contained in:
@@ -149,6 +149,8 @@ class Book:
|
|||||||
newelm.appendChild(newdom.createTextNode(text))
|
newelm.appendChild(newdom.createTextNode(text))
|
||||||
elif elm.localName == "img":
|
elif elm.localName == "img":
|
||||||
pass
|
pass
|
||||||
|
elif elm.nodeType == xml.dom.Node.COMMENT_NODE:
|
||||||
|
pass
|
||||||
elif elm.localName == "a":
|
elif elm.localName == "a":
|
||||||
a_node = cast(xml.dom.minidom.Element, elm.firstChild)
|
a_node = cast(xml.dom.minidom.Element, elm.firstChild)
|
||||||
while a_node:
|
while a_node:
|
||||||
@@ -191,5 +193,9 @@ class Book:
|
|||||||
while node:
|
while node:
|
||||||
parse_node(section, cast(xml.dom.minidom.Element, node))
|
parse_node(section, cast(xml.dom.minidom.Element, node))
|
||||||
node = node.nextSibling
|
node = node.nextSibling
|
||||||
|
try:
|
||||||
self.sections.append(section.toxml())
|
self.sections.append(section.toxml())
|
||||||
|
except Exception as e:
|
||||||
|
print(src, href)
|
||||||
|
raise e
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user