Função PHP asXML()
Exemplo
Retorne uma string XML bem formada (XML versão 1.0) de um 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();
?>
Definição e uso
A função asXML() retorna uma string XML bem formada (XML versão 1.0) de um objeto SimpleXML.
Sintaxe
SimpleXMLElement::asXML(filename)
Valores de parâmetro
Parameter | Description |
---|---|
filename | Optional. If specified, the data is written to the file, instead of returning a string |
Detalhes técnicos
Valor de retorno: | Uma string (ou TRUE se o parâmetro filename estiver definido) em caso de sucesso. FALSO em caso de falha |
---|---|
Versão do PHP: | 5.0+ |
❮ Referência PHP SimpleXML