Re: [PHP] xmdom clone(true) CDATA + html(?) encoding

2005-07-06 Thread ChaosMedia WebDev



Richard Lynch wrote:



In my limited XML experience...

I have found that firing up the fancy XML parsers and tree-walkers and
XML-writers and all that stuff, pretty much entailed a *LOT* more work
than just hacking the file directly, and stuffing in the XML text that
need to be there, or reading the XML and using http://php.net/explode on
it.
 


well i would personnaly go straight to regexp then


Just my opinion.

Disclaimer:
I consider XML the biggest bugaboo since Y2K -- Blown all out of
proportion and over-saturated by hypesters who have NO CLUE what they're
talking about.
 

you're probbaly partialy right about that, i've seen some quite lame xml 
stuff considering the extreme verbosity of that kind of structure..
anyways i guess the main idea with xml was to build a serious 
replacement for our current html.. And considering your opinion above i 
guess you must think quite the same thing of html, right ?


but what i was merely pointing out in my first email was that php 
seriously lacks a solid xmldom library.. I've used xml to do many many 
things including some fancy ones, using various languages and never had 
to scratch my head trying to understand what was going on, like what 
happens here with php xmldom test..


maybe if you had a more reliable xmldom in php then you'd use it more 
often and find out about the ease of use it can provide sometimes..



Please send flammable replies to /dev/null
Thanks.

 


sorry don't have /dev/null on my windows 2k crap :)

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



[PHP] xmdom clone(true) CDATA + html(?) encoding

2005-07-05 Thread ChaosMedia WebDev

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?
roottype4id82![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;bgt; 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