[lxml-dev] Lost DTD when serialising
Stefan Behnel
stefan_ml at behnel.de
Sat Oct 25 20:15:17 CEST 2008
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialise-internal-subset.patch
Type: text/x-patch
Size: 1333 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20081025/aeeb9c4b/attachment.bin
More information about the lxml-dev
mailing list