[lxml-dev] Lost DTD when serialising
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
Hi, Alex Klizhentas wrote:
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/>
Time machine strikes again, I just fixed this fifteen minutes ago and was just in the middle of testing it. :) Here's a patch. Stefan
Great, thanks! 2008/10/25 Stefan Behnel <stefan_ml@behnel.de>
Hi,
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
Alex Klizhentas wrote: 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/>
Time machine strikes again, I just fixed this fifteen minutes ago and was just in the middle of testing it. :)
Here's a patch.
Stefan
-- Regards, Alex
participants (2)
-
Alex Klizhentas
-
Stefan Behnel