Documentation

Horde_Kolab_Format_Xml_Helper
in package

Provides DOM utility methods.

Copyright 2011-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Tags
category

Kolab

author

Gunnar Wrobel wrobel@pardus.de

license

http://www.horde.org/licenses/lgpl21 LGPL

link
http://www.horde.org/libraries/Horde_Kolab_Format

Table of Contents

$_xmldoc  : DOMDocument
The XML document this object works with.
$_xpath  : DOMXpath
The XPath query handler.
__construct()  : mixed
Constructor
__toString()  : string
Output the document as XML string.
appendXml()  : DOMNode
Append an XML snippet.
createNewNode()  : DOMNode
Create a new node.
createNodeValue()  : DOMNode
Store a value as a new text node.
fetchNodeValue()  : string|null
Fetch the value of a node.
findNode()  : DOMNode|false
Return a single named node matching the given XPath query.
findNodeRelativeTo()  : DOMNode|false
Return a single named node below the given context matching the given XPath query.
findNodes()  : DOMNodeList
Return all nodes matching the given XPath query.
findNodesRelativeTo()  : DOMNodeList
Return all nodes matching the given XPath query.
removeNodes()  : null
Remove named nodes from a parent node.
replaceFirstNodeTextValue()  : null
Store a value as a new text node.
storeNewNodeValue()  : DOMNode
Store a value as a new text node.
_fetchFirstTextNode()  : DOMNode|null
Fetch the the first text node.

Properties

$_xmldoc

The XML document this object works with.

protected DOMDocument $_xmldoc

$_xpath

The XPath query handler.

private DOMXpath $_xpath

Methods

__construct()

Constructor

public __construct(DOMDocument $xmldoc) : mixed
Parameters
$xmldoc : DOMDocument

The XML document this object works with.

Return values
mixed

__toString()

Output the document as XML string.

public __toString() : string
Return values
string

The XML output.

appendXml()

Append an XML snippet.

public appendXml(DOMNode $parent_node, string $xml) : DOMNode
Parameters
$parent_node : DOMNode

Attach the XML below this parent.

$xml : string

The XML to append.

Return values
DOMNode

The new child node.

createNewNode()

Create a new node.

public createNewNode(DOMNode $parent_node, string $name) : DOMNode
Parameters
$parent_node : DOMNode

Attach the new node to this parent.

$name : string

Name of the new child node.

Return values
DOMNode

The new child node.

createNodeValue()

Store a value as a new text node.

public createNodeValue(DOMNode $parent_node, string $name, string $value) : DOMNode
Parameters
$parent_node : DOMNode

Attach the new node to this parent.

$name : string

Name of the new child node.

$value : string

Text value of the new child node.

Return values
DOMNode

The new child node.

fetchNodeValue()

Fetch the value of a node.

public fetchNodeValue(DOMNode $node) : string|null
Parameters
$node : DOMNode

Retrieve the text value for this node.

Return values
string|null

The text value or null if no value was identified.

findNode()

Return a single named node matching the given XPath query.

public findNode(string $query) : DOMNode|false
Parameters
$query : string

The query.

Return values
DOMNode|false

The named DOMNode or empty if no node was found.

findNodeRelativeTo()

Return a single named node below the given context matching the given XPath query.

public findNodeRelativeTo(string $query, DOMNode $context) : DOMNode|false
Parameters
$query : string

The query.

$context : DOMNode

Search below this node.

Return values
DOMNode|false

The named DOMNode or empty if no node was found.

findNodes()

Return all nodes matching the given XPath query.

public findNodes(string $query) : DOMNodeList
Parameters
$query : string

The query.

Return values
DOMNodeList

The list of DOMNodes.

findNodesRelativeTo()

Return all nodes matching the given XPath query.

public findNodesRelativeTo(string $query, DOMNode $context) : DOMNodeList
Parameters
$query : string

The query.

$context : DOMNode

Search below this node.

Return values
DOMNodeList

The list of DOMNodes.

removeNodes()

Remove named nodes from a parent node.

public removeNodes(DOMNode $parent_node, string $name) : null
Parameters
$parent_node : DOMNode

The parent node.

$name : string

The name of the children to be removed.

Return values
null

replaceFirstNodeTextValue()

Store a value as a new text node.

public replaceFirstNodeTextValue(DOMNode $node, string $value) : null
Parameters
$node : DOMNode

Replace the text value of this node.

$value : string

Text value of the new child node.

Return values
null

storeNewNodeValue()

Store a value as a new text node.

public storeNewNodeValue(DOMNode $parent_node, string $name, string $value) : DOMNode
Parameters
$parent_node : DOMNode

Attach the new node to this parent.

$name : string

Name of the new child node.

$value : string

Text value of the new child node.

Return values
DOMNode

The new child node.

_fetchFirstTextNode()

Fetch the the first text node.

private _fetchFirstTextNode(DOMNode $node) : DOMNode|null
Parameters
$node : DOMNode

Retrieve the text value for this node.

Return values
DOMNode|null

The first text node or null if no such node was found.

Search results