ID: 42421
User updated by: hejunbin at yahoo dot com dot cn
Reported By: hejunbin at yahoo dot com dot cn
-Status: Bogus
+Status: Open
Bug Type: SimpleXML related
Operating System: windows 2003
PHP Version: 5.2.3
New Comment:
<![CDATA[C]]> and C
i think it's different!
that's why xml document have CDATA node.
so i think it is a problem.
hope some one can resolve it.
Previous Comments:
------------------------------------------------------------------------
[2007-08-25 07:54:51] [EMAIL PROTECTED]
There's no difference betweeen <![CDATA[C]]> and just C from an XML
point of view... It's the same, just differently serialized
------------------------------------------------------------------------
[2007-08-25 07:19:34] hejunbin at yahoo dot com dot cn
Description:
------------
the simplexmlelement can not currently modify cdata node
Reproduce code:
---------------
<?php
$xml_string = <<<EOD
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<a>
<b>b</b>
<c><![CDATA[c]]></c>
</a>
EOD;
$xml = simplexml_load_string($xml_string);
$a = $xml->xpath('//a');
$a[0]-> b = B;
$a[0]-> c = C;
echo $xml-> saveXML();
?>
<a>
<b>B</b>
<c>C</c>
</a>
Expected result:
----------------
<?php
$xml_string = <<<EOD
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<a>
<b>b</b>
<c><![CDATA[c]]></c>
</a>
EOD;
$xml = simplexml_load_string($xml_string);
$a = $xml->xpath('//a');
$a[0]-> b = B;
$a[0]-> c = C;
echo $xml-> saveXML();
?>
<a>
<b>B</b>
<c><![CDATA[C]]</c>
</a>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42421&edit=1