[lxml-dev] Lost DTD when serialising

Alex Klizhentas klizhentas at gmail.com
Sat Oct 25 20:21:58 CEST 2008


Great, thanks!

2008/10/25 Stefan Behnel <stefan_ml at behnel.de>

> 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
>



-- 
Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20081025/f8ef1944/attachment.htm 


More information about the lxml-dev mailing list