QDomCharacterData Class

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

Header: #include <QDomCharacterData>
qmake: QT += xml
Inherits: QDomNode
Inherited By:

QDomComment and QDomText

Note: All functions in this class are reentrant.

Public Functions

QDomCharacterData(const QDomCharacterData &x)
QDomCharacterData()
QDomCharacterData &operator=(const QDomCharacterData &x)
void appendData(const QString &arg)
QString data() const
void deleteData(unsigned long offset, unsigned long count)
void insertData(unsigned long offset, const QString &arg)
int length() const
QDomNode::NodeType nodeType() const
void replaceData(unsigned long offset, unsigned long count, const QString &arg)
void setData(const QString &v)
QString substringData(unsigned long offset, unsigned long count)

Detailed Description

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.

Member Function Documentation

QDomCharacterData::QDomCharacterData(const QDomCharacterData &x)

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::QDomCharacterData()

Constructs an empty character data object.

QDomCharacterData &QDomCharacterData::operator=(const QDomCharacterData &x)

Assigns x to this character data.

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().

void QDomCharacterData::appendData(const QString &arg)

Appends the string arg to the stored string.

QString QDomCharacterData::data() const

Returns the string stored in this object.

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

See also setData().

void QDomCharacterData::deleteData(unsigned long offset, unsigned long count)

Deletes a substring of length count from position offset.

void QDomCharacterData::insertData(unsigned long offset, const QString &arg)

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

int QDomCharacterData::length() const

Returns the length of the stored string.

QDomNode::NodeType QDomCharacterData::nodeType() const

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

void QDomCharacterData::replaceData(unsigned long offset, unsigned long count, const QString &arg)

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

void QDomCharacterData::setData(const QString &v)

Sets this object's string to v.

See also data().

QString QDomCharacterData::substringData(unsigned long offset, unsigned long count)

Returns the substring of length count from position offset.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.