#42421 [Opn->Bgs]: can not currently modify cdata node

From: Date: Sat, 25 Aug 2007 07:54:52 +0000
Subject: #42421 [Opn->Bgs]: can not currently modify cdata node
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116655@lists.php.net to get a copy of this message
ID: 42421 Updated by: chregu@php.net Reported By: hejunbin at yahoo dot com dot cn -Status: Open +Status: Bogus Bug Type: SimpleXML related Operating System: windows 2003 PHP Version: 5.2.3 New Comment: There's no difference betweeen <![CDATA[C]]> and just C from an XML point of view... It's the same, just differently serialized Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#116655) next »