xmdom clone(true) & CDATA + html(?) encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lo all,

don't really know if it's the correct list to post to but didn't see any xml lists besides the dev one, so don't hesitate to tell me where i should post if i was wrong.. i'm no php coder so my experience is quite thin, if you have an answer to my prob please keep that in mind ;)
i'm using php 4.3 on linux / apache2 (debian stable)

my little project is quite simple and my problem is too..

I need to get some data from a remote server hosting various websites, i've build a small "soap style" script on the remote server to provide the requested data to the client thru xml.. the xml data produced by the remote server is very simple, like the following sequence :

<?xml version="1.0"?>
<root><type4><id82><![CDATA[Interview David Martinez - Concepteur DVD HK Vidéo]]></id82></type4></root>

my php script on the client server places requests for various data on the remote server and then stores each of them in a local xml file, used as a cache.. the xml tree of the local file is exactly the same as the one provided by the remote server, although the local file stores multiple "typeX" and "idXX" nodes, of course..

The first thing i had to deal with was the fact you can't append a node from one xmldom object to another, the first xmldom object being a handle to my local (cache) file and the second being the data returned by the request placed on the remote server.. So i'm using the clone(true) method to clone the node (with child tree) in my second xml object (remote data) so i can append it at the right place in my first object (cache file).. And that works fine BUT when performing the clone(true) the original CDATA section, inside the idXX node, desapears.. So the cloned node appended to my cache file has no CDATA section and the text, that was inside that CDATA section, seems to be html encoded.. with things like "l&#xE9;gende" which should be "légende" (legend in english :)

So i'd like to know what's the matter with xmldom and CDATA, or maybe simply the clone() method and CDATA sections.. and maybe also why xmldom encodes the text that way.. html special chars are also htmlencoded like "&lt;b&gt;" for "<b>".. but when extracted fro the xml cache file to be displayed in an php script the html codes are correct but the special ascii chars are screwed like this "légende" for word i mentionned earlier..

I've tried a few things but couldn't find any ways to properly restore those ascii chars.. and i really wouldn't like to have to create and append the cdata section manually..

Thx for you help..

Marc

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux