Función PHP asXML()
Ejemplo
Devuelve una cadena XML bien formada (XML versión 1.0) desde un objeto 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();
?>
Definición y uso
La función asXML() devuelve una cadena XML bien formada (XML versión 1.0) de un objeto SimpleXML.
Sintaxis
SimpleXMLElement::asXML(filename)
Valores paramétricos
Parameter | Description |
---|---|
filename | Optional. If specified, the data is written to the file, instead of returning a string |
Detalles técnicos
Valor devuelto: | Una cadena (o VERDADERO si el parámetro de nombre de archivo está configurado) en caso de éxito. FALSO en falla |
---|---|
Versión PHP: | 5.0+ |
❮ Referencia PHP SimpleXML