Edits to Python 3.5.1: 20.8. xml.dom.pulldom
Hello Documentation Maintainer, 1) Typo: In the code example for expandNode(node) in section 20.8.1, the following code appears: xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>’ 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! Regards, Matthew Cole Binghamton University New York, USA
On Wed, Mar 30, 2016 at 2:31 AM, Matthew Cole <mcole8@binghamton.edu> wrote:
Hello Documentation Maintainer,
1) Typo:
In the code example for expandNode(node) in section 20.8.1, the following code appears:
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>’ 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?
Hi Matthew, Thank your for your report. I've addressed both of your suggestions in https://hg.python.org/cpython/rev/a38c6e6084cb --Berker
participants (2)
-
Berker Peksağ
-
Matthew Cole