doc = pulldom.parseString(xml)
for event, node in doc:
if event == pulldom.START_ELEMENT and node.tagName == 'p':
# Following statement only prints '<p/>'
print(node.toxml())
doc.exandNode(node)
# Following statement prints node with all its children '<p>Some text <div>and more</div></p>'
print(node.toxml())
The line reading doc.exandNode(node) should read doc.expandNode(node) instead.
2) Recommendation:
Also in section 20.8.1, in an above code sample from section 20.8, the import statement is shown:
from xml.dom import pulldom
The code sample in section 20.8.1 only works if you include that import statement, so may I recommend adding it?
Thanks for your hard work!