Current Location: Home> Function Categories> asXML

asXML

Returns a well-formed XML string from a SimpleXML object (XML version 1.0).
Name:asXML
Category:Uncategorized
Programming Language:php
One-line Description:Returns a well-formed XML string from a SimpleXML object (XML version 1.0).

Definition and usage

asXML() function returns a well-formed XML string from a SimpleXML object (XML version 1.0).

Example

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

grammar

 SimpleXMLElement :: asXML ( filename )
parameter describe
filename Optional. If specified, the data is written to the file instead of returning a string.
Similar Functions
Popular Articles