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 |
__construct(string $version, string $encoding) : void
Creates the XML document.
| deprecated | [2012-07-24] class was renamed to cXmlWriter |
|---|
stringversion of XML document (optional, default: 1.0)
stringencoding 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.
| inherited_from | \cXmlWriter::addElement() |
|---|
stringname of the element
stringvalue of the element (optional)
arrayarray of attributes added to this element (optional)
\DOMElementcreated 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() |
|---|---|
| inherited_from | \cXmlWriter::arrayToXml() |
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 SimpleXMLElementgetDomDocument() : \DOMDocument
| inherited_from | \cXmlBase::getDomDocument() |
|---|---|
| inherited_from | \cXmlWriter::getDomDocument() |
getEncoding() : string
| inherited_from | \cXmlBase::getEncoding() |
|---|---|
| inherited_from | \cXmlWriter::getEncoding() |
\cException |
if there is no DOM document |
|---|
stringencodinggetLevelXpath(string $path, integer $level) : string
| static | |
|---|---|
| inherited_from | \cXmlBase::getLevelXpath() |
| inherited_from | \cXmlWriter::getLevelXpath() |
stringXPath to extend
integerlevel
stringextended XPathregisterXpathNamespace(string $name, string $value)
| inherited_from | \cXmlBase::registerXpathNamespace() |
|---|---|
| inherited_from | \cXmlWriter::registerXpathNamespace() |
string
string
resolvePath(string $path) : string
." statement for moving up one level in path.
| static | |
|---|---|
| inherited_from | \cXmlBase::resolvePath() |
| inherited_from | \cXmlWriter::resolvePath() |
stringpath to resolve
stringresolved pathsaveToFile(string $directory, string $fileName) : boolean
| inherited_from | \cXmlWriter::saveToFile() |
|---|
stringpath to destination directory
stringname of the written file
\cException |
if the directory is not writable |
|---|
booleanstate of saving process (true if file was created, false
otherwise)saveToString() : string
| inherited_from | \cXmlWriter::saveToString() |
|---|
stringXML treesetDomDocument(\DOMDocument $domDocument) : void
| inherited_from | \cXmlBase::setDomDocument() |
|---|---|
| inherited_from | \cXmlWriter::setDomDocument() |
xmlStringToArray(string $xmlString)
Example:
becomes
array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );
| inherited_from | \cXmlBase::xmlStringToArray() |
|---|---|
| inherited_from | \cXmlWriter::xmlStringToArray() |
stringcontains 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() |
|---|---|
| inherited_from | \cXmlWriter::xmlToArray() |
\SimpleXMLElement
_addElementAttributes(\DOMElement $element, array $attributes) : \DOMElement
| access | protected |
|---|---|
| inherited_from | \cXmlWriter::_addElementAttributes() |
arrayarray of attributes
\DOMElementDOM element with assigned attributes_createDocument(string $version, string $encoding) : void
| access | protected |
|---|---|
| inherited_from | \cXmlBase::_createDocument() |
| inherited_from | \cXmlWriter::_createDocument() |
stringversion of DOMDocument (optional, default: 1.0)
stringencoding of DOMDocumen (optional, default: UTF-8)
_initXpathInstance() : void
| inherited_from | \cXmlBase::_initXpathInstance() |
|---|---|
| inherited_from | \cXmlWriter::_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() |
|---|---|
| inherited_from | \cXmlWriter::_cleanArray() |
arraythe array to clean
arraythe cleaned array$_dom
| inherited_from | \cXmlBase::$$_dom |
|---|---|
| inherited_from | \cXmlWriter::$$_dom |
$_xpath
| inherited_from | \cXmlBase::$$_xpath |
|---|---|
| inherited_from | \cXmlWriter::$$_xpath |