PHP Class Horde_Kolab_Format_Xml_Helper, horde

Copyright 2011-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Exibir arquivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_xmldoc DOMDocument The XML document this object works with.

Public Methods

Method Description
__construct ( DOMDocument $xmldoc ) Constructor
__toString ( ) : string Output the document as XML string.
appendXml ( DOMNode $parent_node, string $xml ) : DOMNode Append an XML snippet.
createNewNode ( DOMNode $parent_node, string $name ) : DOMNode Create a new node.
createNodeValue ( DOMNode $parent_node, string $name, string $value ) : DOMNode Store a value as a new text node.
fetchNodeValue ( DOMNode $node ) : string | null Fetch the value of a node.
findNode ( string $query ) : DOMNode | false Return a single named node matching the given XPath query.
findNodeRelativeTo ( string $query, DOMNode $context ) : DOMNode | false Return a single named node below the given context matching the given XPath query.
findNodes ( string $query ) : DOMNodeList Return all nodes matching the given XPath query.
findNodesRelativeTo ( string $query, DOMNode $context ) : DOMNodeList Return all nodes matching the given XPath query.
removeNodes ( DOMNode $parent_node, string $name ) : null Remove named nodes from a parent node.
replaceFirstNodeTextValue ( DOMNode $node, string $value ) : null Store a value as a new text node.
storeNewNodeValue ( DOMNode $parent_node, string $name, string $value ) : DOMNode Store a value as a new text node.

Private Methods

Method Description
_fetchFirstTextNode ( DOMNode $node ) : DOMNode | null Fetch the the first text node.

Method Details

__construct() public method

Constructor
public __construct ( DOMDocument $xmldoc )
$xmldoc DOMDocument The XML document this object works with.

__toString() public method

Output the document as XML string.
public __toString ( ) : string
return string The XML output.

appendXml() public method

Append an XML snippet.
public appendXml ( DOMNode $parent_node, string $xml ) : DOMNode
$parent_node DOMNode Attach the XML below this parent.
$xml string The XML to append.
return DOMNode The new child node.

createNewNode() public method

Create a new node.
public createNewNode ( DOMNode $parent_node, string $name ) : DOMNode
$parent_node DOMNode Attach the new node to this parent.
$name string Name of the new child node.
return DOMNode The new child node.

createNodeValue() public method

Store a value as a new text node.
public createNodeValue ( DOMNode $parent_node, string $name, string $value ) : DOMNode
$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 DOMNode The new child node.

fetchNodeValue() public method

Fetch the value of a node.
public fetchNodeValue ( DOMNode $node ) : string | null
$node DOMNode Retrieve the text value for this node.
return string | null The text value or null if no value was identified.

findNode() public method

Return a single named node matching the given XPath query.
public findNode ( string $query ) : DOMNode | false
$query string The query.
return DOMNode | false The named DOMNode or empty if no node was found.

findNodeRelativeTo() public method

Return a single named node below the given context matching the given XPath query.
public findNodeRelativeTo ( string $query, DOMNode $context ) : DOMNode | false
$query string The query.
$context DOMNode Search below this node.
return DOMNode | false The named DOMNode or empty if no node was found.

findNodes() public method

Return all nodes matching the given XPath query.
public findNodes ( string $query ) : DOMNodeList
$query string The query.
return DOMNodeList The list of DOMNodes.

findNodesRelativeTo() public method

Return all nodes matching the given XPath query.
public findNodesRelativeTo ( string $query, DOMNode $context ) : DOMNodeList
$query string The query.
$context DOMNode Search below this node.
return DOMNodeList The list of DOMNodes.

removeNodes() public method

Remove named nodes from a parent node.
public removeNodes ( DOMNode $parent_node, string $name ) : null
$parent_node DOMNode The parent node.
$name string The name of the children to be removed.
return null

replaceFirstNodeTextValue() public method

Store a value as a new text node.
public replaceFirstNodeTextValue ( DOMNode $node, string $value ) : null
$node DOMNode Replace the text value of this node.
$value string Text value of the new child node.
return null

storeNewNodeValue() public method

Store a value as a new text node.
public storeNewNodeValue ( DOMNode $parent_node, string $name, string $value ) : DOMNode
$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 DOMNode The new child node.

Property Details

$_xmldoc protected_oe property

The XML document this object works with.
protected DOMDocument $_xmldoc
return DOMDocument