Reply to Re: appendData() DOM

Your name:

Reply:


Posted by James on 09/17/05 22:55

Janwillem Borleffs wrote:

> CDATA is data encapsuled between '<![CDATA[' and ']]>' markers. The
> advantage of CDATA sections is that you can put anything in between,
> including invalid xml and/or characters as these sections are ignored by
> the parser.

Perect, this is just what I was looking for. Thank you!

>
> $buffer = '<html><body>bla</body></html>';
> $dom = new DomDocument;
> $dom->LoadHTML($buffer);
> $body = $dom->getElementsByTagName('body');
> $body->item(0)->nodeValue .= ' bla';
>
> // Prints: <html><body>bla bla</body></html>
> print $dom->saveHTML();
>

I was actually really trying to do something very similar to what you've got
above. My issue was that when I set

$body->item(0)->nodeValue .= '<b>blah</b>';

The tags would get a treatment with htmlentities(). I tried turning that
behavior off:

$dom->substituteEntities = false;

But that didn't really do what I wanted. The CDATA markers do exactly what I
need.

> Posting is fine and even better then from some 'experienced' posters.

Flattered :)

Thanks again,
James

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация