most complete xml package for Python?

Paul Boddie paul at boddie.org.uk
Thu Mar 15 17:45:44 EDT 2007


Diez B. Roggisch wrote:
> metaperl schrieb:
> >
> > Well, I'm not a troll. And I am now even less impressed with
> > ElementTree. It does not preserve the document but reforms it in
> > certain cases.
> >
> > <script></script>
> >
> > gets rewritten as
> >
> > <script />
> >
> > which leads to problems when embedding Dojo Rich Text Editors.
>
> Beside the fact that this is a problem of browsers (which won't help you
> much, as you have to deal with this somehow, blaming browsers alone
> isn't solving problems I'm just too aware of), I wonder: which XML
> framework _does_ preserve such tags?

I can't remember exactly how I solved this within an XML/XSLT-heavy
Java-based framework, mostly to satisfy Internet Explorer if I
remember correctly, but it does lead to some fairly inelegant hacks.
Something like this might work:

<script><![CDATA[]]></script>

I note that such things are mentioned here (the first search result
for "CDATA" when I tried):

http://www.w3schools.com/xml/xml_cdata.asp

Paul

P.S. I'm off to fix CDATA support in libxml2dom, but I'm sure lxml
supports CDATA. Not sure about Amara, though. ;-)




More information about the Python-list mailing list