Minidom output of XML escaped characters

Discussion in 'Python' started by Derek Basch, Mar 25, 2005.

  1. Derek Basch

    Derek Basch Guest

    Hello,

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

    Any suggestions?

    Thanks,
    Derek Basch
    Derek Basch, Mar 25, 2005
    #1
    1. Advertising

  2. 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>
    Fredrik Lundh, Mar 25, 2005
    #2
    1. Advertising

  3. Derek Basch

    Derek Basch Guest

    Derek Basch, Mar 25, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    759
  2. Ben Finney
    Replies:
    2
    Views:
    338
    Josiah Carlson
    Apr 3, 2004
  3. Peter Møllerud
    Replies:
    2
    Views:
    946
    Stefan Behnel
    Sep 9, 2006
  4. Guest
    Replies:
    2
    Views:
    753
    Guest
    Jun 20, 2007
  5. Replies:
    3
    Views:
    530
    Stefan Behnel
    Aug 3, 2007
Loading...

Share This Page