[XML-SIG] losing cdata tag

Martin v. Loewis martin@v.loewis.de
27 May 2002 08:43:37 +0200


Paul Tremblay <phthenry@earthlink.net> writes:

> Yes, I was afraid this was the case. In fact, I don't know what
> parser I am using! Pardon me for my ignorance. I know that expat
> in on my system. I also know that just about 3 weeks ago I
> downloaded the library from python--not the newest one, but the
> one that has been a standard for a long time. (Does the snippet
> of code tell you what parsere I am using?)

Not really. It first tries pirxx (which is not part of PyXML, but
could be installed on your system); it then tries xmlproc, then
expat. With PyXML installed and pirxx not, it will always use xmlproc.

> the data is not escaped.

I cannot reproduce this problem. Given the document

<?xml version="1.0"?>
<foo>
<![CDATA[<some text>]]>
</foo>

your original code will produce the output

*** Using <xml.sax.drivers2.drv_xmlproc.XmlprocDriver instance at 0x4020910c>
<?xml version="1.0" encoding="iso-8859-1"?>
<foo>
&lt;some text&gt;
</foo>

with PyXML 0.7.1, and pirx not installed. If I remove the xmlproc
option, I get

*** Using <xml.sax.expatreader.ExpatParser instance at 0x4020910c>
<?xml version="1.0" encoding="iso-8859-1"?>
<foo>
<![CDATA[<some text>]]>
</foo>

so with pyexpat, it even puts the CDATA back in. So again, I cannot
see a problem.

Regards,
Martin