# perldoc > XML::DOM::CharacterData

---
type: CommandReference
command: XML::DOM::CharacterData
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `$data = $node->getData()` — get character data of node
- `$node->setData($string)` — set character data
- `$len = $node->getLength()` — number of characters in data
- `$sub = $node->substringData($offset, $count)` — extract substring
- `$node->appendData($string)` — append string to data
- `$node->insertData($offset, $string)` — insert string at offset
- `$node->deleteData($offset, $count)` — remove range of characters
- `$node->replaceData($offset, $count, $string)` — replace range with string

## Name

XML::DOM::CharacterData — Common interface for Text, CDATASections and Comments

## Synopsis

`XML::DOM::CharacterData` extends `XML::DOM::Node`.  
No DOM objects correspond directly to this class; it is inherited by `Text`, `Comment`, and `CDATASection`.

## Options (Methods)

- `getData` / `setData` — Access or modify the character data of the node. The DOM implementation may not put arbitrary limits on the amount of data, but `substringData` may be needed to retrieve large data in pieces.
- `getLength` — The number of characters available through `data` and `substringData`. May be zero.
- `substringData(offset, count)` — Extracts a range of data from the node. If `offset` + `count` exceeds the length, all characters to the end are returned.
- `appendData(str)` — Appends the string to the end of the character data.
- `insertData(offset, arg)` — Inserts a string at the specified character offset.
- `deleteData(offset, count)` — Removes a range of characters. If `offset` + `count` exceeds length, all characters from `offset` to the end are deleted.
- `replaceData(offset, count, arg)` — Replaces the characters starting at `offset` with the specified string. If `offset` + `count` exceeds length, the effect is a removal of the range followed by an append.

## See Also

- [XML::DOM::Node](http://localhost/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ANode/markdown)
- [XML::DOM::Text](http://localhost/phpMan.php/perldoc/XML%3A%3ADOM%3A%3AText/markdown)
- [XML::DOM::Comment](http://localhost/phpMan.php/perldoc/XML%3A%3ADOM%3A%3AComment/markdown)
- [XML::DOM::CDATASection](http://localhost/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ACDATASection/markdown)