Fonction PHP asXML()
Exemple
Renvoie une chaîne XML bien formée (XML version 1.0) à partir d'un objet SimpleXML :
<?php
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Do not forget me this weekend!</body>
</note>
XML;
$xml = new SimpleXMLElement($note);
echo $xml->asXML();
?>
Définition et utilisation
La fonction asXML() renvoie une chaîne XML bien formée (XML version 1.0) à partir d'un objet SimpleXML.
Syntaxe
SimpleXMLElement::asXML(filename)
Valeurs des paramètres
Parameter | Description |
---|---|
filename | Optional. If specified, the data is written to the file, instead of returning a string |
Détails techniques
Valeur de retour : | Une chaîne (ou TRUE si le paramètre filename est défini) en cas de succès. FAUX en cas d'échec |
---|---|
Version PHP : | 5.0+ |
❮ Référence PHP SimpleXML