Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
824
PHP SimpleXML: Function Save
PHP
Version: (no
version information might be only in CVS) I tried with PHP5 and it works.
Description
Creates an XML document
from the dom representation.
The number of bytes written is returned. This function is usually called after
building a new dom document
from scratch as in the example below.
Usage
intDOMDocument->save
( string filename)
The filename is the name of the file in which the xml file will be
written.
In the above example, I
first created a new XML document from the domDocumentclass by using the new keyword, and then I pull XML string( $xmlstr) into the DOMDocument
object using the loadXMLfunction of the object. Finally, I
saved the DOMDocument into a file using save() function and echo out the number of
bytes written.
Output:
You will find a file named save.xml
in /php/xml_files
directory.