\Horde_Kolab_Format_Xml_Helper

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.

Summary

Methods
Properties
Constants
__construct()
fetchNodeValue()
storeNewNodeValue()
createNodeValue()
appendXml()
createNewNode()
replaceFirstNodeTextValue()
findNode()
findNodeRelativeTo()
findNodes()
findNodesRelativeTo()
removeNodes()
__toString()
No public properties found
No constants found
No protected methods found
$_xmldoc
N/A
_fetchFirstTextNode()
$_xpath
N/A

Properties

$_xmldoc

$_xmldoc : \DOMDocument

The XML document this object works with.

Type

\DOMDocument

$_xpath

$_xpath : \DOMXpath

The XPath query handler.

Type

\DOMXpath

Methods

__construct()

__construct(\DOMDocument  $xmldoc) 

Constructor

Parameters

\DOMDocument $xmldoc

The XML document this object works with.

fetchNodeValue()

fetchNodeValue(\DOMNode  $node) : string|null

Fetch the value of a node.

Parameters

\DOMNode $node

Retrieve the text value for this node.

Returns

string|null —

The text value or null if no value was identified.

storeNewNodeValue()

storeNewNodeValue(\DOMNode  $parent_node, string  $name, string  $value) : \DOMNode

Store a value as a new text node.

Parameters

\DOMNode $parent_node

Attach the new node to this parent.

string $name

Name of the new child node.

string $value

Text value of the new child node.

Returns

\DOMNode —

The new child node.

createNodeValue()

createNodeValue(\DOMNode  $parent_node, string  $name, string  $value) : \DOMNode

Store a value as a new text node.

Parameters

\DOMNode $parent_node

Attach the new node to this parent.

string $name

Name of the new child node.

string $value

Text value of the new child node.

Returns

\DOMNode —

The new child node.

appendXml()

appendXml(\DOMNode  $parent_node, string  $xml) : \DOMNode

Append an XML snippet.

Parameters

\DOMNode $parent_node

Attach the XML below this parent.

string $xml

The XML to append.

Returns

\DOMNode —

The new child node.

createNewNode()

createNewNode(\DOMNode  $parent_node, string  $name) : \DOMNode

Create a new node.

Parameters

\DOMNode $parent_node

Attach the new node to this parent.

string $name

Name of the new child node.

Returns

\DOMNode —

The new child node.

replaceFirstNodeTextValue()

replaceFirstNodeTextValue(\DOMNode  $node, string  $value) : NULL

Store a value as a new text node.

Parameters

\DOMNode $node

Replace the text value of this node.

string $value

Text value of the new child node.

Returns

NULL

findNode()

findNode(string  $query) : \DOMNode|false

Return a single named node matching the given XPath query.

Parameters

string $query

The query.

Returns

\DOMNode|false —

The named DOMNode or empty if no node was found.

findNodeRelativeTo()

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

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

Parameters

string $query

The query.

\DOMNode $context

Search below this node.

Returns

\DOMNode|false —

The named DOMNode or empty if no node was found.

findNodes()

findNodes(string  $query) : \DOMNodeList

Return all nodes matching the given XPath query.

Parameters

string $query

The query.

Returns

\DOMNodeList —

The list of DOMNodes.

findNodesRelativeTo()

findNodesRelativeTo(string  $query, \DOMNode  $context) : \DOMNodeList

Return all nodes matching the given XPath query.

Parameters

string $query

The query.

\DOMNode $context

Search below this node.

Returns

\DOMNodeList —

The list of DOMNodes.

removeNodes()

removeNodes(\DOMNode  $parent_node, string  $name) : NULL

Remove named nodes from a parent node.

Parameters

\DOMNode $parent_node

The parent node.

string $name

The name of the children to be removed.

Returns

NULL

__toString()

__toString() : string

Output the document as XML string.

Returns

string —

The XML output.

_fetchFirstTextNode()

_fetchFirstTextNode(\DOMNode  $node) : \DOMNode|null

Fetch the the first text node.

Parameters

\DOMNode $node

Retrieve the text value for this node.

Returns

\DOMNode|null —

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