[lxml-dev] Lost DTD when serialising
Alex Klizhentas
klizhentas at gmail.com
Sat Oct 25 20:04:44 CEST 2008
Hi All, I've read that
"
Serialising an ElementTree now includes any internal DTD subsets that are
part of the document, as well as comments and PIs that are siblings of the
root node.
" (from changelog)
but I've failed to achieve this goal, dtd data is lost:
root = lxml.etree.parse(StringIO("""<?xml version="1.0"
encoding="utf-8"?>
<!DOCTYPE schema [
<!ATTLIST reference id ID #REQUIRED>
<!ATTLIST joined_values id ID #REQUIRED>
<!ATTLIST file id ID #REQUIRED>
<!ATTLIST lookup id ID #REQUIRED>
<!ATTLIST selector id ID #REQUIRED>
<!ATTLIST Column id ID #REQUIRED>
]>
<schema/>
"""))
print lxml.etree.tostring(root)
prints me
<schema/>
What am I doing wrong?
Thanks in advance,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20081025/9ab9b830/attachment.htm
More information about the lxml-dev
mailing list