How to output XML from PHP and have it display “nicely”?

I'm using php's SOAPClient class to make SOAP requests and to get SOAP responses, but I need to display the request and response xml on the page for debugging purposes. Problem is, I can't figure out how.I can use the __getLastRequest() and __getLastResponse() methods to get the xml strings, but I have not found a way to print them out nicely. I did discover that echo'ing out \[code\]<xmp>[xmlstringhere]</xmp>\[/code\] puts the appropriate xml tags in the string, but there aren't any line breaks, which is a problem since the xml response is HUGE. If only I could get line breaks in the appropriate places, and proper indenting, things would be golden.Up until now I've been having to copy the outputted xml, save it as a .xml file, and open that. Is there a way to output things in a readable format via php?Thanks!
 
Top