Array2XML Class

De ZanPHP
zan/classes/class.array2xml.php

This class allows you to convert XML format arrays.


Contenido

Loading this class

This class is loaded using the following code:

 $this->Array2XML = $this->core("Array2XML");


Attributes

@var private $XML = NULL

build($array, $ID)

Generates XML.

checkForHTML($string)

Check if a node contains HTML.

printXML($array, $root = "data", $ID = "node")

Prints a XML created from an array.

 $this->Array2XML = $this->core("Array2XML");
 
 $data = array(
    0 => array(
          "name"  => "Carlos Santana",
          "email" => "carlos@milkzoft.com"
         ),
 
    1 => array(
          "name"  => "Carlos Hugo",
          "email" => "carlos.hugo@milkzoft.com"
         ),
 );
 
 $this->Array2XML->printXML($data, "data", "contact");


 //Prints
 <?xml version="1.0" encoding="UTF-8"?>
 <data>
     <contact>
          <name>Carlos Santana</name>
          <email>carlos@mlkzoft.com</email>
     </contact>
 
     <contact>
          <name>Carlos Hugo</name>
          <email>carlos.hugo@mlkzoft.com</email>
     </contact>
 </data>

toXML($array, $root = "data", $ID = "node")

Call to build() method to generate the XML.


Es.png Clase Array2XML

Left.png Translations Cache Class Right.png

Herramientas personales