Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
XML Class Reference

Static Public Member Functions

static nodeListToArray (DomNodeList $nodeList)
 
static getElementsByTagNames (array $tagNames, DomNode $elem)
 
static getElementsByAttributeValue (DomDocument $doc, DomNode $element, $attr, $value, $recursive=TRUE)
 
static hasChildElements (DomNode $node)
 
static getFirstChildElement (DomNode $node)
 
static getChildAt (DomNode $node, $position)
 
static childCount (DomNode $node)
 
static traverseDom (DomElement $element)
 
static setAttributes (DomElement $element, array $attributes)
 

Detailed Description

Library for handling data in XML form.

Since
4.0.0

Definition at line 18 of file XML.inc.

Member Function Documentation

static childCount ( DomNode  $node)
static

Returns the number of child nodes for specified node.

Parameters
DomNode$nodeDom node.
Since
4.0.0
Returns
integer

Definition at line 183 of file XML.inc.

static getChildAt ( DomNode  $node,
  $position 
)
static

Returns the child element node of the given node at the given position.

Parameters
DomNode$nodeDom node.
integer$positionPosition.
Since
4.0.0
Returns
object

Definition at line 157 of file XML.inc.

static getElementsByAttributeValue ( DomDocument  $doc,
DomNode  $element,
  $attr,
  $value,
  $recursive = TRUE 
)
static

Searches for given attribute value under the given element.

If recusrive set to false then only 1 level will be searched.

Parameters
DomDocument$docXml document.
DomNode$elementParent element.
string$attrName of the attribute.
string$valueAttribute value.
boolean$recursiveRecurse the dom tree.
Since
4.0.0
Returns
DOMNodeList

Definition at line 81 of file XML.inc.

static getElementsByTagNames ( array  $tagNames,
DomNode  $elem 
)
static

Searches under the passed element for elements of any of the passed type.

Parameters
array$tagNamesAn array of tag names to search for.
DomNode$elemThe element to search under.
Since
4.0.0
Returns
array

Definition at line 51 of file XML.inc.

static getFirstChildElement ( DomNode  $node)
static

Returns the first child element node of the given node.

Unlike fisrChild, getFirstChildElement returns the first XML_ELEMENT_NODE. Returns NULL if non found.

Parameters
DomNode$nodeDom node.
Since
4.0.0
Returns
object

Definition at line 135 of file XML.inc.

static hasChildElements ( DomNode  $node)
static

Returns TRUE if the given node has element node.

Unlike hasChildNodes, hasChildElements returns false if it cannot find a XML_ELEMENT_NODE.

Parameters
DomNode$nodeDom node.
Since
4.0.0
Returns
boolean

Definition at line 109 of file XML.inc.

static nodeListToArray ( DomNodeList  $nodeList)
static

Converts a DomNodeList to an array containing its' elements.

Parameters
DomNodeList$nodeListList of nodes to convert.
Since
4.0.0
Returns
array

Definition at line 30 of file XML.inc.

static setAttributes ( DomElement  $element,
array  $attributes 
)
static

Allows multiple attributes of a DomElement to be set simultaneously.

Parameters
DomElement$elementThe element to set the attributes for.
array$attributesAn associate array of the form: array( $attrname => $attrValue, ..., ).
Since
4.0.0
Returns
DomElement

Definition at line 247 of file XML.inc.

static traverseDom ( DomElement  $element)
static

Traverse DOM tree from given start node.

Returns details about each element it comes across and these elements' children.

Parameters
DomElement$elementNode to start from.
Since
4.0.0
Returns
array

Definition at line 208 of file XML.inc.


The documentation for this class was generated from the following file: