(PHP 5, PHP 7, PHP 8)
public appendChild(DOMNode $node): DOMNode|false
public C14N( bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null ): string|false
public C14NFile( string $uri, bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null ): int|false
public cloneNode(bool $deep = false): DOMNode|false
public compareDocumentPosition(DOMNode $other): int
public contains(DOMNode|DOMNameSpaceNode|null $other): bool
public getLineNo(): int
public getNodePath(): ?string
public getRootNode(?array $options = null): DOMNode
public hasAttributes(): bool
public hasChildNodes(): bool
public insertBefore(DOMNode $node, ?DOMNode $child = null): DOMNode|false
public isDefaultNamespace(string $namespace): bool
public isEqualNode(?DOMNode $otherNode): bool
public isSameNode(DOMNode $otherNode): bool
public isSupported(string $feature, string $version): bool
public lookupNamespaceURI(?string $prefix): ?string
public lookupPrefix(string $namespace): ?string
public normalize(): void
public removeChild(DOMNode $child): DOMNode|false
public replaceChild(DOMNode $node, DOMNode $child): DOMNode|false
public __sleep(): array
public __wakeup(): void}
DOMNode::DOCUMENT_POSITION_DISCONNECTED DOMNode::DOCUMENT_POSITION_PRECEDING DOMNode::DOCUMENT_POSITION_FOLLOWING DOMNode::DOCUMENT_POSITION_CONTAINS DOMNode::DOCUMENT_POSITION_CONTAINED_BY DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC Returns the most accurate name for the current node type
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.
Gets the type of the node. One of the predefined XML_*_NODE constants
The parent of this node. If there is no such node, this returns null.
The parent element of this element. If there is no such element, this returns null.
A DOMNodeList that contains all children of this node. If there are no children, this is an empty DOMNodeList.
The first child of this node. If there is no such node, this returns null.
The last child of this node. If there is no such node, this returns null.
The node immediately preceding this node. If there is no such node, this returns null.
The node immediately following this node. If there is no such node, this returns null.
A DOMNamedNodeMap containing the attributes of this node (if it is a DOMElement) or null otherwise.
Whether the node is connected to a document
The DOMDocument object associated with this node, or null if this node does not have an associated document (e.g. if it is detached, or if it is a DOMDocument).
The namespace URI of this node, or null if it is unspecified.
The namespace prefix of this node.
Returns the local part of the qualified name of this node.
The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
The text content of this node and its descendants.
| Version | Description |
|---|---|
| 8.4.0 | Method DOMNode::compareDocumentPosition() has been added. |
| 8.4.0 | Constants DOMNode::DOCUMENT_POSITION_DISCONNECTED, DOMNode::DOCUMENT_POSITION_PRECEDING, DOMNode::DOCUMENT_POSITION_FOLLOWING, DOMNode::DOCUMENT_POSITION_CONTAINS, DOMNode::DOCUMENT_POSITION_CONTAINED_BY, and DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC have been added. |
| 8.3.0 | Methods DOMNode::contains(), and DOMNode::isEqualNode() have been added. |
| 8.3.0 | Properties DOMNode::$parentElement, and DOMNode::$isConnected have been added. |
| 8.0.0 | The unimplemented methods DOMNode::compareDocumentPosition(), DOMNode::isEqualNode(), DOMNode::getFeature(), DOMNode::setUserData() and DOMNode::getUserData() have been removed. |
Note:
The DOM extension uses UTF-8 encoding. Use mb_convert_encoding(), UConverter::transcode(), or iconv() to handle other encodings.
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.domnode.php