| Home | Trees | Indices | Help |
|
|---|
unserialize(...
unserialize(...
'<!DOCTYPE points [\n<!ENTITY % user-entities SYS...
'lxml.tests'
Test QName handling.
- decorated tags
>>> elem = ElementTree.Element("{uri}tag") >>> serialize(elem) # 1.1 '<ns0:tag xmlns:ns0="uri"/>'
## 2) decorated attributes
## >>> elem.attrib["{uri}key"] = "value" ## >>> serialize(elem) # 2.1 ## '<ns0:tag ns0:key="value" xmlns:ns0="uri"/>'
Test copy handling (etc).
>>> import copy >>> e1 = unserialize("<tag>hello<foo/></tag>") >>> # e2 = copy.copy(e1) >>> e3 = copy.deepcopy(e1) >>> e1.find("foo").tag = "bar">>> serialize(e1).replace(' ', '') '<tag>hello<bar/></tag>'
## >>> serialize(e2).replace(' ', '') ## '<tag>hello<bar/></tag>'
>>> serialize(e3).replace(' ', '') '<tag>hello<foo/></tag>'
unserialize("""
<body>
<tag>text</tag>
<tag />
<section>
<tag>subtext</tag>
</section>
</body>
...
unserialize("""
<body xmlns="http://effbot.org/ns">
<tag>text</tag>
<tag />
<section>
<tag>subtext</tag>
</section>
</body>
...
'''<!DOCTYPE points [<!ENTITY % user-entities SYSTEM \'user-entities.xml\'>%user-entities;]><document>&entity;</document>'''
| Home | Trees | Indices | Help |
|
|---|