|  | Home · All Classes · Modules

# QDomCharacterData Class Reference
[QtXml module]

The QDomCharacterData class represents a generic string in the DOM. More...

Inherits QDomNode.

Inherited by QDomComment and QDomText.

### Methods

- __init__ (self)
- __init__ (self, QDomCharacterData)
- appendData (self, QStringQString)
- QStringQString data (self)
- deleteData (self, int, int)
- insertData (self, int, QStringQString)
- int length (self)
- QDomNode.NodeType nodeType (self)
- replaceData (self, int, int, QStringQString)
- setData (self, QStringQString)
- QStringQString substringData (self, int, int)

## Detailed Description

The QDomCharacterData class represents a generic string in the DOM.

Character data as used in XML specifies a generic data string. More specialized versions of this class are QDomText, QDomComment and QDomCDATASection.

The data string is set with setData() and retrieved with data(). You can retrieve a portion of the data string using substringData(). Extra data can be appended with appendData(), or inserted with insertData(). Portions of the data string can be deleted with deleteData() or replaced with replaceData(). The length of the data string is returned by length().

The node type of the node containing this character data is returned by nodeType().

See also QDomText, QDomComment, and QDomCDATASection.

## Method Documentation

### QDomCharacterData.__init__ (self)

Constructs an empty character data object.

### QDomCharacterData.__init__ (self, QDomCharacterData)

Constructs a copy of x.

The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().

### QDomCharacterData.appendData (self, QStringQString)

Appends the string arg to the stored string.

### QStringQString QDomCharacterData.data (self)

Returns the string stored in this object.

If the node is a null node, it will return an empty string.

See also setData().

### QDomCharacterData.deleteData (self, int, int)

Deletes a substring of length count from position offset.

### QDomCharacterData.insertData (self, int, QStringQString)

Inserts the string arg into the stored string at position offset.

### int QDomCharacterData.length (self)

Returns the length of the stored string.

### QDomNode.NodeType QDomCharacterData.nodeType (self)

Returns the type of node this object refers to (i.e. `TextNode`, `CDATASectionNode`, `CommentNode` or `CharacterDataNode`). For a null node, returns `CharacterDataNode`.

### QDomCharacterData.replaceData (self, int, int, QStringQString)

Replaces the substring of length count starting at position offset with the string arg.

### QDomCharacterData.setData (self, QStringQString)

Sets this object's string to v.

See also data().

### QStringQString QDomCharacterData.substringData (self, int, int)

Returns the substring of length count from position offset.