Minidom output of XML escaped characters

Fredrik Lundh fredrik at pythonware.com
Fri Mar 25 07:18:11 CET 2005


Derek Basch wrote:

> If I want minidom to output XHTML that includes normally XML escaped
> characters how would I do it?
>
> For instance if I use doc.createCDATASection() I get:
>
> <![CDATA[<!--#include virtual="/top.html" -->]]>
>
> and without the CDATASection:
>
> &lt;!--#include virtual="/top.html" -->
>
> when I really need:
>
> <!--#include virtual="/top.html" -->

that's an XML comment.  if you want to insert a comment, insert a
comment:

    elem.appendChild(
        mydoc.createComment('#include virtual="/top.html"')
    )

</F> 






More information about the Python-list mailing list