This question has two parts.
Part 1. Yesterday I had some code which would echo the entire content of the XML from an RSS feed. Then I deleted it fr
The simplexml_load_file returns an SimpleXMLElement, so:
simplexml_load_file
print_r($xml);
will show its minor objects and arrays.
After your tweaks you can call $xml->asXML("filename.xml"); as @Tim Withers pointed out.