Project: CONTENIDO Content Management System
Description: The XML writer 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 |
__construct(string $version, string $encoding) : void
Creates the XML document.
string
version of XML document (optional, default: 1.0)
string
encoding of XML document (optional, default: UTF-8)
addElement(string $name, string $value, \DOMElement $rootElement, array $attributes) : \DOMElement
If no root element is given the element will be appended to the root node.
string
name of the element
string
value of the element (optional)
array
array of attributes added to this element (optional)
\DOMElement
created DOM elementarrayToXml(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
inherited_from | \cXmlBase::arrayToXml() |
---|
array
the array which should be converted to XML
string
[optional] the root tag name which should be used - is only used when $xml is null!
\SimpleXMLElement
the array as a SimpleXMLElementgetEncoding() : string
inherited_from | \cXmlBase::getEncoding() |
---|
\cException |
if there is no DOM document |
---|
string
encodinggetLevelXpath(string $path, integer $level) : string
static | |
---|---|
inherited_from | \cXmlBase::getLevelXpath() |
string
XPath to extend
integer
level
string
extended XPathregisterXpathNamespace(string $name, string $value)
inherited_from | \cXmlBase::registerXpathNamespace() |
---|
string
string
resolvePath(string $path) : string
." statement for moving up one level in path.
static | |
---|---|
inherited_from | \cXmlBase::resolvePath() |
string
path to resolve
string
resolved pathsaveToFile(string $directory, string $fileName) : boolean
string
path to destination directory
string
name of the written file
\cException |
if the directory is not writable |
---|
boolean
state of saving process (true if file was created, false
otherwise)saveToString() : string
string
XML treesetDomDocument(\DOMDocument $domDocument) : void
xmlStringToArray(string $xmlString)
Example:
becomes
array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
inherited_from | \cXmlBase::xmlStringToArray() |
---|
string
contains a valid XML structure
xmlToArray(\SimpleXMLElement $xml)
Example:
becomes
array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
inherited_from | \cXmlBase::xmlToArray() |
---|
\SimpleXMLElement
_addElementAttributes(\DOMElement $element, array $attributes) : \DOMElement
access | protected |
---|
array
array of attributes
\DOMElement
DOM element with assigned attributes_createDocument(string $version, string $encoding) : void
access | protected |
---|---|
inherited_from | \cXmlBase::_createDocument() |
string
version of DOMDocument (optional, default: 1.0)
string
encoding of DOMDocumen (optional, default: UTF-8)
_initXpathInstance() : void
inherited_from | \cXmlBase::_initXpathInstance() |
---|
\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.
inherited_from | \cXmlBase::_cleanArray() |
---|
array
the array to clean
array
the cleaned array$_dom
inherited_from | \cXmlBase::$$_dom |
---|
$_xpath
inherited_from | \cXmlBase::$$_xpath |
---|