Handling quotes in xml.dom text nodes
Stefan Behnel
stefan_ml at behnel.de
Tue Apr 13 12:35:00 EDT 2010
Chaim Krause, 13.04.2010 17:26:
> I am building a web page (HTML 4.01 Transitional) using
> xml.dom.minidom. I have created a<script> node and I have added the
> Javascript as a child text node. The issue is that the Javascript
> includes quotes that I want to survive when I write the XML to a file.
> The issue for me is that they are translated into".
You should use an HTML generator tool rather than a generic XML tool like
xml.dom.minidom. You need something that knows that the <script> tag
contains CDATA content in HTML, and that can serialise in an HTML aware way
(self-closing tags, etc.).
Check the Python Wiki or PyPI, they have tons of HTML generators.
Stefan
More information about the Python-list
mailing list