Reply to parse only content from node containing CDATA using DOM

Your name:

Reply:


Posted by Peter Parker on 12/31/07 08:25

I am using php5 to parse node content from a xml file. Could someone show me
if it's possible to to print the content without the ![CDATA[]] tags in the
following codes ? Thank you in advance

....
$colors = $doc->getElementsByTagName("color");

foreach($colors as $node) {
// to print only 'red' without the ![CDATA[]] tags as in
<color>![CDATA[red]]</color>
// I have tried the following lines but none of them worked, just printed
out emptry string
echo $node->textContent;
echo $node->firstChild->nodeValue;
echo $node->firstChild->data;
}

[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

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