BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
PHP XML
PHP SimpleXML Function load_string
PHP SimpleXML Function Load_File
PHP SimpleXML Function LoadXML
PHP SimpleXML Function Load
PHP SimpleXML Function Open_File
PHP SimpleXML Function xml_parser_create
PHP SimpleXML Create an XML Document
PHP XML RPC Function Server Call method
PHP XML RPC Parse Method Descriptions
PHP XML RPC Function ServerCreate
PHP XML RPC Function GetType
PHP XML RPC Function EncodeRequest
PHP XML RPC Function Encode
PHP XML RPC Function DecodeRequest
PHP DOMXPath Function registerNamespace
PHP DOMXPath Function query
PHP DOMText Function splitText
PHP DOMText Function isWhitespaceInElementContent
PHP DOMNode Function replaceChild
PHP DOMNode Function lookupPrefix
 
 

By :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.

Example of How to use save():

<?php

$xmlstr = <<<XML

<employee>

<employeename>test</employeename>

<employeeaddress>test123</employeeaddress>

<SSN>12343456</SSN>

<company>TOPXML</company>

</employee>

XML;

$dom = new domDocument;

$dom->loadXML($xmlstr);

$test = $dom->save("C:/topxml_demo/php/xml_files/save.xml");

echo "The number of bytes written :".$test;

?>

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.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C
Sr. Software Engineer

View all Jobs (Add yours)
View all CV (Add yours)



free conference call
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses
masks


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP