The DOMNode class
(PHP 5, PHP 7, PHP 8)
類摘要
bool
$exclusive
= false
,bool
$withComments
= false
,?array
$xpath
= null
,?array
$nsPrefixes
= null
): string|false
string
$uri
,bool
$exclusive
= false
,bool
$withComments
= false
,?array
$xpath
= null
,?array
$nsPrefixes
= null
): int|false
屬性
- 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
null
otherwise. - ownerDocument
-
The DOMDocument object associated with this node, or
null
if this node is a DOMDocument - namespaceURI
-
The namespace URI of this node, or
null
if it is unspecified. - prefix
-
The namespace prefix of this node, or
null
if it is unspecified. - localName
-
Returns the local part of the qualified name of this node.
- baseURI
-
The absolute base URI of this node or
null
if the implementation wasn't able to obtain an absolute URI. - textContent
-
The text content of this node and its descendants.
更新日誌
版本 | 說明 |
---|---|
8.0.0 | The unimplemented methods DOMNode::compareDocumentPosition(), DOMNode::isEqualNode(), DOMNode::getFeature(), DOMNode::setUserData() and DOMNode::getUserData() have been removed. |
註釋
注意:
此 DOM 擴充套件採用 UTF-8 編碼。使用 mb_convert_encoding()、UConverter::transcode() 或 iconv() 來處理其它編碼。
目錄
- 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