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

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 1:38 am, ChaosMedia > WebDev said:
> 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

Why pull out the slower and more complicated RegExp engine to break up
some text on a constant " and
   Nah, even then, easier to explode on ">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 ?

I like HTML okay for what it was designed to be, and what it still does
quite nicely... which is not what a lot of Designers seem to think it
should be able to do, and they're going to force it to do, no matter how
inappropriate.

I hate CSS for its abject failure to be usable in consistent ways across
browsers, major holes in its feature-set, and even more hype than XML ever
got.  Maybe some day this will all be fixed, and CSS will be "Good"  It at
least has potential for massive good, unlike XML, which was a limited tool
for specific situations, at best.

> 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..

Feel free to fix up any of the three XML engines in PHP, or add yet
another one that's better. :-)

> 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..

I never had a problem with the XML parser reliability...  Only with the
sheer volume and complexity of code I would have had to type to do
something incredibly simple and stupid.

Course, I wasn't ever trying to shove multi-byte multi-lingual CDATA
around either. :-)

That said, I still believe http://php.net/explode and http://php.net/fopen
are the way to go if you want to get this done in an efficient and
maintenance-free way.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



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



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

2005-07-05 Thread Richard Lynch
On Tue, July 5, 2005 7:18 am, ChaosMedia > WebDev said:
> 
> 

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.

Obviously, this is a heretical and Luddite world-view, but there it is.

You can solve this problem in FIVE MINUTES with fopen/fwrite and go on to
something productive, or you can dink around for the next couple months
with giant software packages that basically are giving you NO ADDED VALUE
for what you want to do.  Take your pick.

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.

Please send flammable replies to /dev/null
Thanks.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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 :





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é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 
"" for "".. 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