Php/docs/class.domnode
(PHP 5, PHP 7)
Class synopsis
DOMNode {
public
readonly
string
$nodeName
public
string
$nodeValue
public
readonly
int
$nodeType
public
readonly
DOMNode|null
$parentNode
public
readonly
DOMNodeList
$childNodes
public
readonly
DOMNode|null
$firstChild
public
readonly
DOMNode|null
$lastChild
public
readonly
DOMNode|null
$previousSibling
public
readonly
DOMNode|null
$nextSibling
public
readonly
DOMNamedNodeMap|null
$attributes
public
readonly
DOMDocument|null
$ownerDocument
public
readonly
string|null
$namespaceURI
public
string
$prefix
public
readonly
string
$localName
public
readonly
string|null
$baseURI
public
string
$textContent
/* Methods */
public appendChild
( DOMNode $newnode
) : DOMNode
public C14N
([ bool $exclusive
[, bool $with_comments
[, array $xpath
[, array $ns_prefixes
]]]] ) : string|false
public C14NFile
( string $uri
[, bool $exclusive = FALSE
[, bool $with_comments = FALSE
[, array $xpath
[, array $ns_prefixes
]]]] ) : int|false
public getLineNo ( ) : int
public getNodePath ( ) : string
public hasAttributes ( ) : bool
public hasChildNodes ( ) : bool
public insertBefore
( DOMNode $newnode
[, DOMNode $refnode
] ) : DOMNode
public isDefaultNamespace
( string $namespaceURI
) : bool
public isSameNode
( DOMNode $node
) : bool
public isSupported
( string $feature
, string $version
) : bool
public lookupNamespaceUri
( string $prefix
) : string
public lookupPrefix
( string $namespaceURI
) : string
public normalize ( ) : void
public removeChild
( DOMNode $oldnode
) : DOMNode
public replaceChild
( DOMNode $newnode
, DOMNode $oldnode
) : DOMNode
}
Properties
nodeName- Returns the most accurate name for the current node type
nodeValue- The value of this node, depending on its type. Contrary to the W3C specification, the node value of DOMElement nodes is equal to DOMNode::textContent instead of
NULL. nodeType- Gets the type of the node. One of the predefined XML_xxx_NODE constants
parentNode- The parent of this node. If there is no such node, this returns
NULL. childNodes- A DOMNodeList that contains all children of this node. If there are no children, this is an empty DOMNodeList.
firstChild- The first child of this node. If there is no such node, this returns
NULL. lastChild- The last child of this node. If there is no such node, this returns
NULL. previousSibling- The node immediately preceding this node. If there is no such node, this returns
NULL. nextSibling- The node immediately following this node. If there is no such node, this returns
NULL. attributes- A DOMNamedNodeMap containing the attributes of this node (if it is a DOMElement) or
NULLotherwise. ownerDocument- The DOMDocument object associated with this node, or
NULLif this node is a DOMDOcument namespaceURI- The namespace URI of this node, or
NULLif it is unspecified. prefix- The namespace prefix of this node, or
NULLif it is unspecified. localName- Returns the local part of the qualified name of this node.
baseURI- The absolute base URI of this node or
NULLif the implementation wasn't able to obtain an absolute URI. textContent- The text content of this node and its descendants.
Notes
Note:
The DOM extension uses UTF-8 encoding. Use utf8_encode() and utf8_decode() to work with texts in ISO-8859-1 encoding or iconv for other encodings.
Changelog
| Version | Description |
|---|---|
| 5.6.1 | The textContent property has been made writable (formerly it has been
readonly). |
Table of Contents
- DOMNode::appendChild — Adds new child at the end of the children
- DOMNode::C14N — Canonicalize nodes to a string
- DOMNode::C14NFile — Canonicalize nodes to a file
- DOMNode::cloneNode — Clones a node
- DOMNode::getLineNo — Get line number for a node
- DOMNode::getNodePath — Get an XPath for a node
- DOMNode::hasAttributes — Checks if node has attributes
- DOMNode::hasChildNodes — Checks if node has children
- DOMNode::insertBefore — Adds a new child before a reference node
- DOMNode::isDefaultNamespace — Checks if the specified namespaceURI is the default namespace or not
- DOMNode::isSameNode — Indicates if two nodes are the same node
- DOMNode::isSupported — Checks if feature is supported for specified version
- DOMNode::lookupNamespaceUri — Gets the namespace URI of the node based on the prefix
- DOMNode::lookupPrefix — Gets the namespace prefix of the node based on the namespace URI
- DOMNode::normalize — Normalizes the node
- DOMNode::removeChild — Removes child from list of children
- DOMNode::replaceChild — Replaces a child
/* Properties */