Documentation

XmlNodeList
in package
implements IteratorAggregate

XmlNodeList

This class represents a list of XML nodes.

Table of Contents

Interfaces

IteratorAggregate

Properties

$document  : DOMDocument
$_data  : DOMNodeList
The list of values.
$_document  : DOMDocument
The document.

Methods

__construct()  : mixed
Constructor
__get()  : mixed
Getter
Count()  : int
Returns the count of nodes.
First()  : XmlNode
Returns the first node.
getIterator()  : XmlNodeListIterator
Returns an iterator for iteration using foreach.
Item()  : XmlNode|null
Returns the node by index.
Last()  : XmlNode
Returns the last node.
offsetGet()  : XmlNode
Remove()  : void
Removes all nodes in the collection.
ToObject()  : array<string|int, mixed>|null
Returns all nodes in the collection as an object.

Properties

$document read-only

public DOMDocument $document

The document.

$_data

The list of values.

private DOMNodeList $_data

$_document

The document.

private DOMDocument $_document

Methods

__construct()

Constructor

public __construct(DOMNodeList $nodelist, DOMDocument $dom) : mixed
Parameters
$nodelist : DOMNodeList

The list of nodes.

$dom : DOMDocument

The document.

__get()

Getter

public __get(string $property) : mixed
Parameters
$property : string

The property.

Return values
mixed

The value of the property, or null if not found.

Count()

Returns the count of nodes.

public Count() : int
Return values
int

The count of nodes.

Item()

Returns the node by index.

public Item(int $index) : XmlNode|null
Parameters
$index : int

The index.

Return values
XmlNode|null

The node, or null if not found.

Remove()

Removes all nodes in the collection.

public Remove() : void

ToObject()

Returns all nodes in the collection as an object.

public ToObject([array<string|int, mixed> $exclude = array() ][, int|null $levels = null ]) : array<string|int, mixed>|null
Parameters
$exclude : array<string|int, mixed> = array()

The list of attribute and node names to exclude.

$levels : int|null = null

The number of child nodes.

Return values
array<string|int, mixed>|null

The nodes as an object, or null if empty.


        
On this page

Search results