Hi Adam, I can modify the xml file without any error , however when I tried to unserializer the xml file using PEAR:XML , it gave the error message below. I have attached my code for your perusal. Any ideas ? thanks <?php ini_set('display_errors', E_ALL); require_once '../library/config.php'; require_once '../library/class.XMLUtil.php'; $xmlfile = "/home/gvintranet/datacraft/htdocs/uploads/cisco.xml"; $xml = preg_replace("/<!\\[CDATA\\[.+?\\]\\]>/", "<![CDATA[ignore_this]]>", $xml); $filehandle = fopen($xmlfile, 'wb'); $ok = fwrite($filehandle,$xml); echo "ok".$ok; $options = array("complexType" => "object"); $xml_util = new XMLUtil($xmlfile, $options); $xml_util->unserializer_XML(true); $data = $xml_util->getUnserializedData(); echo print_r($data); ?> error message: pear_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => 151 [message] => No unserialized data available. Use XML_Unserializer::unserialize() first. [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => /usr/share/pear/PEAR.php [line] => 566 [function] => pear_error [class] => pear_error [type] => -> [args] => Array ( [0] => No unserialized data available. Use XML_Unserializer::unserialize() first. [1] => 151 [2] => 1 [3] => 1024 [4] => ) ) [1] => Array ( [file] => /usr/share/pear/XML/Unserializer.php [line] => 489 [function] => raiseerror [class] => xml_unserializer [type] => -> [args] => Array ( [0] => No unserialized data available. Use XML_Unserializer::unserialize() first. [1] => 151 ) ) [2] => Array ( [file] => /home/gvintranet/datacraft/htdocs/library/class.XMLUtil.php [line] => 54 [function] => getunserializeddata [class] => xml_unserializer [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => /home/gvintranet/datacraft/htdocs/admin/test_regex.php [line] => 43 [function] => getunserializeddata [class] => xmlutil [type] => -> [args] => Array ( ) ) ) [callback] => ) 1 Yeo Wee Tat Tel: +65-62730049 Fax: +65-62734934 Cxrus Solutions Pte Ltd (Singapore . Thailand) 1003 Bukit Merah Central #05-20 Singapore 159836 System Integration . Business Solutions . Linux Simplified -----Original Message----- From: Adam Zey [mailto:azey@xxxxxx] Sent: Wednesday, June 28, 2006 11:11 PM To: weetat Cc: php-general@xxxxxxxxxxxxx Subject: Re: modify xml before parse weetat wrote: > Hi Adam, > > Thank for your input. > However search and replace the value such as > <![CDATA[?ù?¸?ü÷??ú"<?ù?à?ù?Ø??Z4À??Ï]]> to empty string ? Try the > code below , no successful. > > $xmlfile = "/home/gvintranet/datacraft/htdocs/properties/test_cdata.xml"; > > $xml = file_get_contents($xmlfile); > > $xml = > preg_replace('/<HardwareVersion>[^(\\/HardwareVersion)]<\\/HardwareVersion>/ ', > > '<HardwareVersion><\/HardwareVersion>', $xml); > > fwrite(fopen($xmlfile, 'wb'), $xml); > > Thanks > - weetat > > Adam Zey wrote: >> weetat wrote: >>> Hi all, >>> >>> I need to read xml file before it was parsed by PHP DOM functions. >>> The xml file have some encrypted value as shown below : >>> >>> >>> <InstanceName><![CDATA[?ù?¸?ü÷??ú"<?ù?à?ù?Ø??Z4À??Ï]]></InstanceName> >>> >>> Anybody have any suggestion how to do it ? >>> >>> Thanks. >>> >>> - weetat >> >> $xmlfile = file_get_contents("http://urloffile.com/filename.xml"); >> >> I mean, that is what you asked, how to read the xml file... >> >> Regards, Adam Zey. > > Why not: $xml = preg_replace("/<!\\[CDATA\\[.+?\\]\\]>/", "", $xml); (Keep in mind I wrote that regex for RegexCoach and then tried to translate it to PHP, might be some mistakes) Regards, Adam. -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.5/377 - Release Date: 6/27/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php