Project: CONTENIDO Content Management System
Description: The base XML class of CONTENIDO.
| package | CONTENIDO Backend Classes |
|---|---|
| version | 1.0.0 |
| author | Dominik Ziegler |
| copyright | four for business AG |
| license | http://www.contenido.org/license/LIZENZ.txt |
| link | http://www.4fb.de |
| link | http://www.contenido.org |
| since | file available since CONTENIDO release >= 4.9.0 |
arrayToXml(array $array, \SimpleXMLElement $xml, string $rootTagName) : \SimpleXMLElement
Example: array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
becomes
/**
Converts an array to a SimpleXMLElement.
Example:
array(
'key1' => 'value1',
'key2' => array('value21', 'value22'),
'key3' => array('key31' => 'value31', 'key32' => 'value32')
);
becomes
arraythe array which should be converted to XML
string[optional] the root tag name which should be used - is only used when $xml is null!
\SimpleXMLElementthe array as a SimpleXMLElementgetEncoding() : string
getLevelXpath(string $path, integer $level) : string
| static |
|---|
stringXPath to extend
integerlevel
stringextended XPathregisterXpathNamespace(string $name, string $value)
string
string
resolvePath(string $path) : string
." statement for moving up one level in path.
| static |
|---|
stringpath to resolve
stringresolved pathsetDomDocument(\DOMDocument $domDocument) : void
xmlStringToArray(string $xmlString)
Example:
becomes
array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
stringcontains a valid XML structure
xmlToArray(\SimpleXMLElement $xml)
Example:
becomes
array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
\SimpleXMLElement
_createDocument(string $version, string $encoding) : void
| access | protected |
|---|
stringversion of DOMDocument (optional, default: 1.0)
stringencoding of DOMDocumen (optional, default: UTF-8)
_initXpathInstance() : void
\cException |
if there is no valid DOM document |
|---|
_cleanArray(array $array) : array
Additionally, the function replaces all associative arrays which have only empty values with the array keys of the array.
arraythe array to clean
arraythe cleaned array$_dom
$_xpath