SimpleXML: convert xml to text
| From: | Dasn | Date: | Sun, 14 Mar 2010 13:58:36 +0000 |
| Subject: | SimpleXML: convert xml to text | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-302800@lists.php.net to get a copy of this message | ||
Hello, I want to convert some xml stuff to simple string using php, say:
<?php
$string = <<<XML
<a> left <foo>center1<ok>ok</ok>center2</foo>right </a>
XML;
$xml = simplexml_load_string($string);
echo $xml;
?>
The code will output "left right" while all the central stuff was lost.
How should I print it as "left center1 ok center2 right" ?
Thanks in advance, and please Cc me. :)
--
Dasn