QDomCharacterData 类

QDomCharacterData class represents a generic string in the DOM. 更多...

头: #include <QDomCharacterData>
qmake: QT += xml
继承: QDomNode
继承者:

QDomComment and QDomText

注意: 此类的所有函数 可重入 .

公共函数

QDomCharacterData ()
QDomCharacterData (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 )
QDomCharacterData & operator= (const QDomCharacterData & x )

详细描述

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

另请参阅 QDomText , QDomComment ,和 QDomCDATASection .

成员函数文档编制

QDomCharacterData:: QDomCharacterData ()

Constructs an empty character data object.

QDomCharacterData:: QDomCharacterData (const QDomCharacterData & x )

构造副本为 x .

拷贝数据是共享的 (浅拷贝):修改一个节点也将改变另一节点。若想要制作深度副本,使用 cloneNode ().

void QDomCharacterData:: appendData (const QString & arg )

追加字符串 arg to the stored string.

QString QDomCharacterData:: data () const

Returns the string stored in this object.

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

另请参阅 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 节点 , 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 .

另请参阅 data ().

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

Returns the substring of length count from position offset .

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

赋值 x to this character data.

拷贝数据是共享的 (浅拷贝):修改一个节点也将改变另一节点。若想要制作深度副本,使用 cloneNode ().