Re: simplexml and CDATA
- From: Gertjan Klein <gklein@xxxxxxxxx>
- Date: Tue, 08 Aug 2006 10:02:29 +0200
mandric@xxxxxxxxx wrote:
Can someone please enlighten me on how to preserve the <![CDATA[]]>
element when parsing an xml file or string with simplexml. I'm using
libxml 2.6.16 and php 5.1.4.
As far as I've been able to find out this is not possible. However, I
don't think there is a *functional* difference between preserving the
CDATA and what simplexml does. In CDATA sections, you can include e.g.
<i>some</i> HTML elements as-is. They, when parsing, will not result in
separate nodes in the resulting DOM. The XML that $xml->asXML()
generates, escapes the reserved characters (<, >, &) instead. As far as
I can tell this results in functionally the same XML.
Of course, it would be nice if simplexml would remember that a given
element originally held CDATA contents and output it as such. Perhaps
you can file an enhancement request for this.
Gertjan.
--
Gertjan Klein <gklein@xxxxxxxxx>
.
- Follow-Ups:
- Re: simplexml and CDATA
- From: mandric
- Re: simplexml and CDATA
- References:
- simplexml and CDATA
- From: mandric
- simplexml and CDATA
- Prev by Date: Re: Errors?
- Next by Date: how to send a plain text version of an email with html
- Previous by thread: simplexml and CDATA
- Next by thread: Re: simplexml and CDATA
- Index(es):
Relevant Pages
|