Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cXmlBase
  • cXmlReader
  • cXmlWriter
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class cXmlBase

Base XML class

Direct known subclasses

cXmlReader, cXmlWriter
Abstract
Package: Core\XML
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Dominik Ziegler
Located at classes/xml/class.xml.base.php
Methods summary
protected
# _createDocument( string $version = '', string $encoding = '' )

Creates a new XML document using DOMDocument.

Creates a new XML document using DOMDocument.

Parameters

$version
string
$version version of DOMDocument (optional, default: 1.0)
$encoding
string
$encoding encoding of DOMDocumen (optional, default: UTF-8)
public DOMDocument
# getDomDocument( )

Returns the DOMDocument object.

Returns the DOMDocument object.

Returns

DOMDocument
public
# setDomDocument( DOMDocument $domDocument )

Sets a current DOMDocument object to class.

Sets a current DOMDocument object to class.

Parameters

$domDocument
DOMDocument
$domDocument DOMDocument object
public string
# getEncoding( )

Returns the encoding of the XML document.

Returns the encoding of the XML document.

Returns

string
encoding

Throws

cException
if there is no DOM document
public
# registerXpathNamespace( string $name, string $value )

Parameters

$name
string
$name
$value
string
$value
protected
# _initXpathInstance( )

Initializes a new DOMXPath instance for DOMDocument.

Initializes a new DOMXPath instance for DOMDocument.

Throws

cException
if there is no valid DOM document
public static string
# resolvePath( string $path )

Resolves a given path which contains ".." statement for moving up one level in path.

Resolves a given path which contains ".." statement for moving up one level in path.

Parameters

$path
string
$path path to resolve

Returns

string
resolved path
public static string
# getLevelXpath( string $path, integer $level )

Returns given XPath with integrad level definition.

Returns given XPath with integrad level definition.

Parameters

$path
string
$path XPath to extend
$level
integer
$level level

Returns

string
extended XPath
public static SimpleXMLElement
# arrayToXml( array $array, SimpleXMLElement $xml = NULL, string $rootTagName = 'root' )

Converts an array to a SimpleXMLElement. Example: array(
'key1' => 'value1',
'key2' => array('value21', 'value22'),
'key3' => array('key31' => 'value31', 'key32' => 'value32') );

Converts an array to a 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

<?xml version="1.0" encoding="utf-8"?> <root> <key1>value1</key1> <key2> <array_value>value21</array_value> <array_value>value22</array_value> </key2> <key3> <key31>value31</key31> <key32>value32</key32> </key3> </root>

Parameters

$array
array
$array the array which should be converted to XML
$xml
SimpleXMLElement
$xml [optional] the element to which the array should be added
$rootTagName
string
$rootTagName [optional] the root tag name which should be used - is only used when $xml is NULL!

Returns

SimpleXMLElement
the array as a SimpleXMLElement
public static
# xmlStringToArray( string $xmlString )

Converts the given XML string to an array. Example: <?xml version="1.0" encoding="utf-8"?> <root> <key1>value1</key1> <key2> <array_value>value21</array_value> <array_value>value22</array_value> </key2> <key3> <key31>value31</key31> <key32>value32</key32> </key3> </root>

Converts the given XML string to an array. Example: <?xml version="1.0" encoding="utf-8"?> <root> <key1>value1</key1> <key2> <array_value>value21</array_value> <array_value>value22</array_value> </key2> <key3> <key31>value31</key31> <key32>value32</key32> </key3> </root>

becomes

array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );

Parameters

$xmlString
string
$xmlString contains a valid XML structure
public static boolean
# isValidXML( string $xmlString )

Checks if a string is valid XML

Checks if a string is valid XML

Parameters

$xmlString
string
$xmlString

Returns

boolean
True if the XML is valid
public static
# xmlToArray( SimpleXMLElement $xml )

Converts the given SimpleXMLElement object to an array. Example: <?xml version="1.0" encoding="utf-8"?> <root> <key1>value1</key1> <key2> <array_value>value21</array_value> <array_value>value22</array_value> </key2> <key3> <key31>value31</key31> <key32>value32</key32> </key3> </root>

Converts the given SimpleXMLElement object to an array. Example: <?xml version="1.0" encoding="utf-8"?> <root> <key1>value1</key1> <key2> <array_value>value21</array_value> <array_value>value22</array_value> </key2> <key3> <key31>value31</key31> <key32>value32</key32> </key3> </root>

becomes

array( 'key1' => 'value1', 'key2' => array('value21', 'value22'), 'key3' => array('key31' => 'value31', 'key32' => 'value32') );

Parameters

$xml
SimpleXMLElement
$xml
private static array
# _cleanArray( array $array )

Cleans an array by replacing all empty arrays with empty strings. Additionally, the function replaces all associative arrays which have only empty values with the array keys of the array.

Cleans an array by replacing all empty arrays with empty strings. Additionally, the function replaces all associative arrays which have only empty values with the array keys of the array.

Parameters

$array
array
$array the array to clean

Returns

array
the cleaned array
Properties summary
protected mixed $_dom NULL
#
protected mixed $_xpath NULL
#
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0