XmlNodeAttributeList
in package
implements
IteratorAggregate, Countable, ArrayAccess
XmlNodeAttributeList
This class represents a list of attributes associated with a XML node.
Table of Contents
Interfaces
- IteratorAggregate
- Countable
- ArrayAccess
Properties
- $count : int
- $_data : DOMNamedNodeMap
- The list of attributes.
- $_document : DOMDocument
- The document.
- $_node : mixed
- The node.
Methods
- __construct() : mixed
- Constructor
- __get() : XmlAttribute|null
- Getter
- Append() : void
- Appends an attribute.
- Count() : int
- Returns the count of attributes.
- getIterator() : XmlNodeListIterator
- Returns an iterator for iteration using foreach.
- Item() : XmlAttribute
- Returns the attribute by index.
- offsetExists() : bool
- Checks if data exists by index.
- offsetGet() : XmlAttribute
- offsetGet() : mixed
- Retrieves the value by index.
- offsetSet() : void
- Sets the value by index.
- offsetUnset() : void
- Unsets data by index.
- Remove() : void
- Removes an attribute by name.
Properties
$count read-only
public
int
$count
The count of attributes.
$_data
The list of attributes.
private
DOMNamedNodeMap
$_data
$_document
The document.
private
DOMDocument
$_document
$_node
The node.
private
mixed
$_node
Methods
__construct()
Constructor
public
__construct(DOMDocument $document, DOMNode $node, DOMNamedNodeMap $xmlattributes) : mixed
Parameters
- $document : DOMDocument
-
The document.
- $node : DOMNode
-
The node.
- $xmlattributes : DOMNamedNodeMap
-
The list of attributes.
__get()
Getter
public
__get(string $property) : XmlAttribute|null
Parameters
- $property : string
-
The property.
Return values
XmlAttribute|null —The attribute, or null if not found.
Append()
Appends an attribute.
public
Append(string $name, string $value) : void
Parameters
- $name : string
-
The name of the attribute.
- $value : string
-
The value of the attribute.
Count()
Returns the count of attributes.
public
Count() : int
Return values
int —The count of attributes.
getIterator()
Returns an iterator for iteration using foreach.
public
getIterator() : XmlNodeListIterator
Return values
XmlNodeListIteratorItem()
Returns the attribute by index.
public
Item(int $index) : XmlAttribute
Parameters
- $index : int
-
The index.
Return values
XmlAttribute —The attribute.
offsetExists()
Checks if data exists by index.
public
offsetExists(int $offset) : bool
Parameters
- $offset : int
-
The offset.
Return values
bool —Whether the data exists.
offsetGet()
public
offsetGet(mixed $offset) : XmlAttribute
Parameters
- $offset : mixed
Return values
XmlAttributeoffsetGet()
Retrieves the value by index.
public
offsetGet(int $offset) : mixed
Parameters
- $offset : int
-
The offset.
Return values
mixed —The value.
offsetSet()
Sets the value by index.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
-
The offset.
- $value : mixed
-
The value.
offsetUnset()
Unsets data by index.
public
offsetUnset(string $offset) : void
Parameters
- $offset : string
-
The offset.
Remove()
Removes an attribute by name.
public
Remove(string $name) : void
Parameters
- $name : string
-
The name of the attribute.