|
static | init ($version= '1.0', $encoding= 'UTF-8', $format_output=true) |
|
static & | createArray ($input_xml) |
|
Definition at line 24 of file XML2Array.php.
static& createArray |
( |
|
$input_xml | ) |
|
|
static |
Convert an XML to Array
- Parameters
-
string | $node_name | - name of the root node to be converted |
array | $arr | - aray to be converterd |
- Returns
- DOMDocument
Definition at line 49 of file XML2Array.php.
51 $xml = self::getXMLRoot();
52 if (is_string($input_xml))
54 $parsed = $xml->loadXML($input_xml);
57 throw new \Exception(
'[XML2Array] Error parsing the XML string.');
62 if (get_class($input_xml) !=
'DOMDocument')
64 throw new \Exception(
'[XML2Array] The input XML object should be of type: DOMDocument.');
66 $xml = self::$xml = $input_xml;
68 $array[$xml->documentElement->tagName] = self::convert($xml->documentElement);
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 36 of file XML2Array.php.
38 self::$xml = new \DOMDocument($version, $encoding);
39 self::$xml->formatOutput = $format_output;
40 self::$encoding = $encoding;
The documentation for this class was generated from the following file: