Format the SimpleXML object's data in XML in PHP
Description
The following code shows how to format the SimpleXML object's data in XML.
Example
// w w w. j av a 2s . c om
<?php
$note=<<<XML
<note>
<to>Work</to>
<from>Home</from>
<heading>Reminder</heading>
<body>This is a message.</body>
</note>
XML;
$xml=new SimpleXMLElement($note);
echo $xml->asXML();
?>
The code above generates the following result.