mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Fix typo in xml.dom.pulldom.rst
Reported by Matthew Cole on docs@p.o.
This commit is contained in:
commit
fe4c01268c
1 changed files with 3 additions and 1 deletions
|
@ -114,13 +114,15 @@ DOMEventStream Objects
|
||||||
|
|
||||||
Expands all children of *node* into *node*. Example::
|
Expands all children of *node* into *node*. Example::
|
||||||
|
|
||||||
|
from xml.dom import pulldom
|
||||||
|
|
||||||
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
|
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
|
||||||
doc = pulldom.parseString(xml)
|
doc = pulldom.parseString(xml)
|
||||||
for event, node in doc:
|
for event, node in doc:
|
||||||
if event == pulldom.START_ELEMENT and node.tagName == 'p':
|
if event == pulldom.START_ELEMENT and node.tagName == 'p':
|
||||||
# Following statement only prints '<p/>'
|
# Following statement only prints '<p/>'
|
||||||
print(node.toxml())
|
print(node.toxml())
|
||||||
doc.exandNode(node)
|
doc.expandNode(node)
|
||||||
# Following statement prints node with all its children '<p>Some text <div>and more</div></p>'
|
# Following statement prints node with all its children '<p>Some text <div>and more</div></p>'
|
||||||
print(node.toxml())
|
print(node.toxml())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue