All Data Structures Functions Variables Pages
Static Public Member Functions
Array2XML Class Reference

Static Public Member Functions

static init ($version= '1.0', $encoding= 'UTF-8', $format_output=true)
 
static & createXML ($node_name, $arr=array())
 

Detailed Description

Array2XML: A class to convert array in PHP to XML It also takes into account attributes names unlike SimpleXML in PHP It returns the XML in form of DOMDocument class for further manipulation. It throws exception if the tag name or attribute name has illegal chars.

Author : Lalit Patel Website: http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes License: Apache License 2.0 http://www.apache.org/licenses/LICENSE-2.0

Usage: $xml = Array2XML::createXML('root_node_name', $php_array); echo $xml->saveXML();

Definition at line 52 of file Array2XML.php.

Member Function Documentation

static init (   $version = '1.0',
  $encoding = 'UTF-8',
  $format_output = true 
)
static

Initialize the root XML node [optional]

Parameters
$version
$encoding
$format_output

Definition at line 63 of file Array2XML.php.

static& createXML (   $node_name,
  $arr = array() 
)
static

Convert an Array to XML

Parameters
string$node_name- name of the root node to be converted
array$arr- aray to be converterd
Returns
DomDocument

Definition at line 76 of file Array2XML.php.


The documentation for this class was generated from the following file:
Generated on Sat Jan 25 2020 07:10:27