class DOMCdataSection extends DOMText (View source)

The DOMCdataSection inherits from DOMText for textural representation of CData constructs.

Constants

DOCUMENT_POSITION_DISCONNECTED Since: 8.4

DOCUMENT_POSITION_PRECEDING Since: 8.4

DOCUMENT_POSITION_FOLLOWING Since: 8.4

DOCUMENT_POSITION_CONTAINS Since: 8.4

DOCUMENT_POSITION_CONTAINED_BY Since: 8.4

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC Since: 8.4

Properties

string $nodeName from  DOMNode
string|null $nodeValue from  DOMNode
int $nodeType from  DOMNode
DOMNode|null $parentNode from  DOMNode
DOMNode> $childNodes from  DOMNode
DOMNode|null $firstChild from  DOMNode
DOMNode|null $lastChild from  DOMNode
DOMNode|null $previousSibling from  DOMNode
DOMNode|null $nextSibling from  DOMNode
DOMAttr>|null $attributes from  DOMNode
DOMDocument|null $ownerDocument from  DOMNode
string|null $namespaceURI from  DOMNode
string|null $prefix from  DOMNode
string|null $localName from  DOMNode
string|null $baseURI from  DOMNode
string $textContent from  DOMNode
bool $isConnected from  DOMNode
DOMElement|null $parentElement from  DOMNode
string $data from  DOMCharacterData
int $length from  DOMCharacterData
$nextElementSibling from  DOMCharacterData
$previousElementSibling from  DOMCharacterData
$wholeText

Holds all the text of logically-adjacent (not separated by Element, Comment or Processing Instruction) Text nodes.

from  DOMText

Methods

insertBefore(DOMNode $node, null|DOMNode $child = null)

Adds a new child before a reference node

from  DOMNode
DOMNode|false
replaceChild(DOMNode $node, DOMNode $child)

Replaces a child

from  DOMNode
removeChild(DOMNode $child)

Removes child from list of children

from  DOMNode
appendChild(DOMNode $node)

Adds new child at the end of the children

from  DOMNode
bool
hasChildNodes()

Checks if node has children

from  DOMNode
cloneNode(bool $deep = false)

Clones a node

from  DOMNode
void
normalize()

Normalizes the node

from  DOMNode
bool
isSupported(string $feature, string $version)

Checks if feature is supported for specified version

from  DOMNode
bool
hasAttributes()

Checks if node has attributes

from  DOMNode
int
compareDocumentPosition(DOMNode $other)

No description

from  DOMNode
bool
isSameNode(DOMNode $otherNode)

Indicates if two nodes are the same node

from  DOMNode
string|null
lookupPrefix(string $namespace)

Gets the namespace prefix of the node based on the namespace URI

from  DOMNode
bool
isDefaultNamespace(string $namespace)

Checks if the specified namespaceURI is the default namespace or not

from  DOMNode
string|null
lookupNamespaceURI(string|null $prefix)

Gets the namespace URI of the node based on the prefix

from  DOMNode
string|null
lookupNamespaceUri(string|null $prefix)

Gets the namespace URI of the node based on the prefix

from  DOMNode
bool
isEqualNode($otherNode)

No description

from  DOMNode
getFeature($feature, $version)

No description

from  DOMNode
setUserData($key, $data, $handler)

No description

from  DOMNode
getUserData($key)

No description

from  DOMNode
string|null
getNodePath()

Gets an XPath location path for the node

from  DOMNode
int
getLineNo()

Get line number for a node

from  DOMNode
string|false
C14N(bool $exclusive = false, bool $withComments = false, null|array $xpath = null, null|array $nsPrefixes = null)

Canonicalize nodes to a string

from  DOMNode
int|false
C14NFile(string $uri, bool $exclusive = false, bool $withComments = false, null|array $xpath = null, null|array $nsPrefixes = null)

Canonicalize nodes to a file.

from  DOMNode
bool
contains(DOMNode|DOMNameSpaceNode|null $other)

No description

from  DOMNode
getRootNode(array|null $options = null)

No description

from  DOMNode
array
__sleep()

No description

from  DOMNode
void
__wakeup()

No description

from  DOMNode
string
substringData(int $offset, int $count)

Extracts a range of data from the node

appendData(string $data)

Append the string to the end of the character data of the node

bool
insertData(int $offset, string $data)

Insert a string at the specified 16-bit unit offset

bool
deleteData(int $offset, int $count)

Remove a range of characters from the node

bool
replaceData(int $offset, int $count, string $data)

Replace a substring within the DOMCharacterData node

void
remove()

Acts as a simpler version of {DOMNode

void
before(DOMNode|string|null ...$nodes)

Add passed node(s) before the current node

void
after(DOMNode|string|null ...$nodes)

Add passed node(s) after the current node

void
replaceWith(DOMNode|string|null ...$nodes)

Replace current node with new node(s), a combination of {DOMChildNode::remove()} + {DOMChildNode::append()}.

splitText(int $offset)

Breaks this node into two nodes at the specified offset

from  DOMText
bool
isWhitespaceInElementContent()

Indicates whether this text node contains whitespace

from  DOMText
bool
isElementContentWhitespace()

No description

from  DOMText
replaceWholeText($content)

No description

from  DOMText
__construct(string $data)

The value of the CDATA node. If not supplied, an empty CDATA node is created.

Details

DOMNode insertBefore(DOMNode $node, null|DOMNode $child = null)

Adds a new child before a reference node

Parameters

DOMNode $node

The new node.

null|DOMNode $child

[optional]

The reference node. If not supplied, newnode is appended to the children.

Return Value

DOMNode

The inserted node.

DOMNode|false replaceChild(DOMNode $node, DOMNode $child)

Replaces a child

Parameters

DOMNode $node

The new node. It must be a member of the target document, i.e. created by one of the DOMDocument->createXXX() methods or imported in the document by .

DOMNode $child

The old node.

Return Value

DOMNode|false

The old node or false if an error occur.

DOMNode removeChild(DOMNode $child)

Removes child from list of children

Parameters

DOMNode $child

The removed child.

Return Value

DOMNode

If the child could be removed the functions returns the old child.

DOMNode appendChild(DOMNode $node)

Adds new child at the end of the children

Parameters

DOMNode $node

The appended child.

Return Value

DOMNode

The node added.

bool hasChildNodes()

Checks if node has children

Return Value

bool

true on success or false on failure.

DOMNode cloneNode(bool $deep = false)

Clones a node

Parameters

bool $deep

Indicates whether to copy all descendant nodes. This parameter is defaulted to false.

Return Value

DOMNode

The cloned node.

void normalize()

Normalizes the node

Return Value

void

bool isSupported(string $feature, string $version)

Checks if feature is supported for specified version

Parameters

string $feature

The feature to test. See the example of DOMImplementation::hasFeature for a list of features.

string $version

The version number of the feature to test.

Return Value

bool

true on success or false on failure.

bool hasAttributes()

Checks if node has attributes

Return Value

bool

true on success or false on failure.

int compareDocumentPosition(DOMNode $other)

No description

Parameters

DOMNode $other

Return Value

int

bool isSameNode(DOMNode $otherNode)

Indicates if two nodes are the same node

Parameters

DOMNode $otherNode

The compared node.

Return Value

bool

true on success or false on failure.

string|null lookupPrefix(string $namespace)

Gets the namespace prefix of the node based on the namespace URI

Parameters

string $namespace

The namespace URI.

Return Value

string|null

The prefix of the namespace.

bool isDefaultNamespace(string $namespace)

Checks if the specified namespaceURI is the default namespace or not

Parameters

string $namespace

The namespace URI to look for.

Return Value

bool

Return true if namespaceURI is the default namespace, false otherwise.

string|null lookupNamespaceURI(string|null $prefix)

Gets the namespace URI of the node based on the prefix

Parameters

string|null $prefix

The prefix of the namespace.

Return Value

string|null

The namespace URI of the node.

string|null lookupNamespaceUri(string|null $prefix)

Gets the namespace URI of the node based on the prefix

Parameters

string|null $prefix

The prefix of the namespace.

Return Value

string|null

The namespace URI of the node.

bool isEqualNode($otherNode)

No description

Parameters

$otherNode

Return Value

bool

getFeature($feature, $version)

No description

Parameters

$feature
$version

setUserData($key, $data, $handler)

No description

Parameters

$key
$data
$handler

getUserData($key)

No description

Parameters

$key

string|null getNodePath()

Gets an XPath location path for the node

Return Value

string|null

the XPath, or NULL in case of an error.

int getLineNo()

Get line number for a node

Return Value

int

Always returns the line number where the node was defined in.

string|false C14N(bool $exclusive = false, bool $withComments = false, null|array $xpath = null, null|array $nsPrefixes = null)

Canonicalize nodes to a string

Parameters

bool $exclusive

[optional] Enable exclusive parsing of only the nodes matched by the provided xpath or namespace prefixes.

bool $withComments

[optional] Retain comments in output.

null|array $xpath

[optional] An array of xpaths to filter the nodes by.

null|array $nsPrefixes

[optional] An array of namespace prefixes to filter the nodes by.

Return Value

string|false

Canonicalized nodes as a string or FALSE on failure

int|false C14NFile(string $uri, bool $exclusive = false, bool $withComments = false, null|array $xpath = null, null|array $nsPrefixes = null)

Canonicalize nodes to a file.

Parameters

string $uri

Number of bytes written or FALSE on failure

bool $exclusive

[optional] Enable exclusive parsing of only the nodes matched by the provided xpath or namespace prefixes.

bool $withComments

[optional] Retain comments in output.

null|array $xpath

[optional] An array of xpaths to filter the nodes by.

null|array $nsPrefixes

[optional] An array of namespace prefixes to filter the nodes by.

Return Value

int|false

Number of bytes written or FALSE on failure

bool contains(DOMNode|DOMNameSpaceNode|null $other)

Since: 8.3

No description

Parameters

DOMNode|DOMNameSpaceNode|null $other

Return Value

bool

DOMNode getRootNode(array|null $options = null)

Since: 8.3

No description

Parameters

array|null $options

Return Value

DOMNode

array __sleep()

Since: 8.1

No description

Return Value

array

void __wakeup()

Since: 8.1

No description

Return Value

void

string substringData(int $offset, int $count)

Extracts a range of data from the node

Parameters

int $offset

Start offset of substring to extract.

int $count

The number of characters to extract.

Return Value

string

The specified substring. If the sum of offset and count exceeds the length, then all 16-bit units to the end of the data are returned.

appendData(string $data)

Append the string to the end of the character data of the node

Parameters

string $data

The string to append.

bool insertData(int $offset, string $data)

Insert a string at the specified 16-bit unit offset

Parameters

int $offset

The character offset at which to insert.

string $data

The string to insert.

Return Value

bool

bool deleteData(int $offset, int $count)

Remove a range of characters from the node

Parameters

int $offset

The offset from which to start removing.

int $count

The number of characters to delete. If the sum of offset and count exceeds the length, then all characters to the end of the data are deleted.

Return Value

bool

bool replaceData(int $offset, int $count, string $data)

Replace a substring within the DOMCharacterData node

Parameters

int $offset

The offset from which to start replacing.

int $count

The number of characters to replace. If the sum of offset and count exceeds the length, then all characters to the end of the data are replaced.

string $data

The string with which the range must be replaced.

Return Value

bool

void remove()

Acts as a simpler version of {DOMNode

Return Value

void

void before(DOMNode|string|null ...$nodes)

Add passed node(s) before the current node

Parameters

DOMNode|string|null ...$nodes

Return Value

void

void after(DOMNode|string|null ...$nodes)

Add passed node(s) after the current node

Parameters

DOMNode|string|null ...$nodes

Return Value

void

void replaceWith(DOMNode|string|null ...$nodes)

Replace current node with new node(s), a combination of {DOMChildNode::remove()} + {DOMChildNode::append()}.

Parameters

DOMNode|string|null ...$nodes

Return Value

void

DOMText splitText(int $offset)

Breaks this node into two nodes at the specified offset

Parameters

int $offset

The offset at which to split, starting from 0.

Return Value

DOMText

The new node of the same type, which contains all the content at and after the offset.

bool isWhitespaceInElementContent()

Indicates whether this text node contains whitespace

Return Value

bool

true on success or false on failure.

bool isElementContentWhitespace()

No description

Return Value

bool

replaceWholeText($content)

No description

Parameters

$content

__construct(string $data)

The value of the CDATA node. If not supplied, an empty CDATA node is created.

Parameters

string $data

[optional] The value of the text node. If not supplied an empty text node is created.