asXML
Returns a well-formed XML string from a SimpleXML object (XML version 1.0).
asXML()
function returns a well-formed XML string from a SimpleXML object (XML version 1.0).
Return a well-formed XML string from a SimpleXML object (XML version 1.0):
<?php $note = <<< XML <note> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Do not forget the meeting!</body> </note> XML ; $xml = new SimpleXMLElement ( $note ) ; echo $xml -> asXML ( ) ; ?>
Run the instance
SimpleXMLElement :: asXML ( filename )
parameter | describe |
---|---|
filename | Optional. If specified, the data is written to the file instead of returning a string. |