DOMDocument->save

(no version information, might be only in CVS)

DOMDocument->save --  Dumps the internal XML tree back into a file

Description

int DOMDocument->save ( string filename)

Crée un document XML depuis la représentation DOM. Le nombre d'octets écris est retourné. Cette fonction est habituellement appelée après la création d'un nouveau document DOM, comme dans l'exemple suivant.

Exemple 1. Création d'un simple en-tête de document XML

<?php
$doc
= new DOMDocument("1.0");
$root = $doc->createElement("HTML");
$root = $doc->appendChild($root);
$head = $doc->createElement("HEAD");
$head = $root->appendChild($head);
$title = $doc->createElement("TITLE");
$title = $head->appendChild($title);
$text = $doc->createTextNode("Ceci est le titre");
$text = $title->appendChild($text);
$doc->save("/tmp/test.xml");
?>

Voir aussi DOMDocument->load(), DOMDocument->loadXML() et DOMDocument->saveXML().