WIKINDX API trunk

RecursiveDOMIterator implements RecursiveIterator

Recursive Iterator class for the DOM class

Tags
todo

LkpPo, 2022-03-25, remove #[\ReturnTypeWillChange] when PHP 8.1 is the minimum version

Taken from https://github.com/salathe/spl-examples/wiki/RecursiveDOMIterator

see
https://stackoverflow.com/questions/6356115/traverse-the-dom-tree

Table of Contents

Interfaces

RecursiveIterator

Properties

$_nodeList  : DOMNodeList
The DOMNodeList with all children to iterate over
$_position  : int
Current Position in DOMNodeList

Methods

__construct()  : mixed
Constructor
current()  : DOMNode
Returns the current DOMNode
getChildren()  : RecursiveDOMIterator
Returns an iterator for the current iterator entry
hasChildren()  : bool
Returns if an iterator can be created for the current entry
key()  : mixed
Returns the current position
next()  : void
Moves the current position to the next element
rewind()  : void
Rewind the Iterator to the first element
valid()  : bool
Checks if current position is valid

Properties

$_nodeList

The DOMNodeList with all children to iterate over

protected DOMNodeList $_nodeList

Methods

__construct()

Constructor

public __construct(DOMNode $domNode) : mixed
Parameters
$domNode : DOMNode

hasChildren()

Returns if an iterator can be created for the current entry

public hasChildren() : bool
Return values
bool

        
On this page

Search results