Since: 8.4

class Text extends CharacterData (View source)

Constants

DOCUMENT_POSITION_DISCONNECTED

DOCUMENT_POSITION_PRECEDING

DOCUMENT_POSITION_FOLLOWING

DOCUMENT_POSITION_CONTAINS

DOCUMENT_POSITION_CONTAINED_BY

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

Properties

int $nodeType from  Node
string $nodeName from  Node
string $baseURI from  Node
bool $isConnected from  Node
Document|null $ownerDocument from  Node
Node|null $parentNode from  Node
Element|null $parentElement from  Node
Node> $childNodes from  Node
Node|null $firstChild from  Node
Node|null $lastChild from  Node
Node|null $previousSibling from  Node
Node|null $nextSibling from  Node
string|null $nodeValue from  Node
string|null $textContent from  Node
Element|null $previousElementSibling from  CharacterData
Element|null $nextElementSibling from  CharacterData
string $data from  CharacterData
int $length from  CharacterData
string $wholeText

Methods

getRootNode(array $options = [])

No description

from  Node
bool
hasChildNodes()

No description

from  Node
void
normalize()

No description

from  Node
cloneNode(bool $deep = false)

No description

from  Node
bool
isEqualNode(Node|null $otherNode)

No description

from  Node
bool
isSameNode(Node|null $otherNode)

No description

from  Node
int
compareDocumentPosition(Node $other)

No description

from  Node
bool
contains(Node|null $other)

No description

from  Node
string|null
lookupPrefix(string|null $namespace)

No description

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

No description

from  Node
bool
isDefaultNamespace(string|null $namespace)

No description

from  Node
insertBefore(Node $node, Node|null $child)

No description

from  Node
appendChild(Node $node)

No description

from  Node
replaceChild(Node $node, Node $child)

No description

from  Node
removeChild(Node $child)

No description

from  Node
int
getLineNo()

No description

from  Node
string
getNodePath()

No description

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

No description

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

No description

from  Node
array
__sleep()

No description

from  Node
void
__wakeup()

No description

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

Extracts a range of data from the character data

void
appendData(string $data)

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

void
insertData(int $offset, string $data)

Insert a string at the specified UTF-8 codepoint offset

void
deleteData(int $offset, int $count)

Remove a range of characters from the character data

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

Replace a substring within the character data

void
remove()

Removes the character data node

void
before(Node|string ...$nodes)

Adds nodes before the character data

void
after(Node|string ...$nodes)

Adds nodes after the character data

void
replaceWith(Node|string ...$nodes)

Replaces the character data with new nodes

splitText(int $offset)

Breaks this node into two nodes at the specified offset

Details

Node getRootNode(array $options = [])

No description

Parameters

array $options

Return Value

Node

bool hasChildNodes()

No description

Return Value

bool

void normalize()

No description

Return Value

void

Node cloneNode(bool $deep = false)

No description

Parameters

bool $deep

Return Value

Node

bool isEqualNode(Node|null $otherNode)

No description

Parameters

Node|null $otherNode

Return Value

bool

bool isSameNode(Node|null $otherNode)

No description

Parameters

Node|null $otherNode

Return Value

bool

int compareDocumentPosition(Node $other)

No description

Parameters

Node $other

Return Value

int

bool contains(Node|null $other)

No description

Parameters

Node|null $other

Return Value

bool

string|null lookupPrefix(string|null $namespace)

No description

Parameters

string|null $namespace

Return Value

string|null

string|null lookupNamespaceURI(string|null $prefix)

No description

Parameters

string|null $prefix

Return Value

string|null

bool isDefaultNamespace(string|null $namespace)

No description

Parameters

string|null $namespace

Return Value

bool

Node insertBefore(Node $node, Node|null $child)

No description

Parameters

Node $node
Node|null $child

Return Value

Node

Node appendChild(Node $node)

No description

Parameters

Node $node

Return Value

Node

Node replaceChild(Node $node, Node $child)

No description

Parameters

Node $node
Node $child

Return Value

Node

Node removeChild(Node $child)

No description

Parameters

Node $child

Return Value

Node

int getLineNo()

No description

Return Value

int

string getNodePath()

No description

Return Value

string

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

No description

Parameters

bool $exclusive
bool $withComments
array|null $xpath
array|null $nsPrefixes

Return Value

string|false

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

No description

Parameters

string $uri
bool $exclusive
bool $withComments
array|null $xpath
array|null $nsPrefixes

Return Value

int|false

array __sleep()

No description

Return Value

array

void __wakeup()

No description

Return Value

void

string substringData(int $offset, int $count)

Extracts a range of data from the character data

Returns the specified substring.

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 UTF-8 codepoints to the end of the data are returned.

void appendData(string $data)

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

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

Parameters

string $data

The string to append.

Return Value

void

void insertData(int $offset, string $data)

Insert a string at the specified UTF-8 codepoint offset

Inserts string data at position offset.

Parameters

int $offset

The character offset at which to insert.

string $data

The string to insert.

Return Value

void

void deleteData(int $offset, int $count)

Remove a range of characters from the character data

Deletes count characters starting from position offset.

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

void

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

Replace a substring within the character data

Replace count characters starting from position offset with data.

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

void

void remove()

Removes the character data node

Return Value

void

No value is returned.

void before(Node|string ...$nodes)

Adds nodes before the character data

Adds the passed nodes before the character data.

Parameters

Node|string ...$nodes

Nodes to be added before the node. Strings are automatically converted to text nodes.

Return Value

void

No value is returned.

void after(Node|string ...$nodes)

Adds nodes after the character data

Adds the passed nodes after the character data.

Parameters

Node|string ...$nodes

Nodes to be added after the node. Strings are automatically converted to text nodes.

Return Value

void

No value is returned.

void replaceWith(Node|string ...$nodes)

Replaces the character data with new nodes

Parameters

Node|string ...$nodes

The replacement nodes. Strings are automatically converted to text nodes.

Return Value

void

No value is returned.

Text splitText(int $offset)

Breaks this node into two nodes at the specified offset

Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.

Parameters

int $offset

The offset at which to split, starting from 0.

Return Value

Text

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