Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDomCharacterData Class Reference

\reentrant More...

#include <qdom.h>

+ Inheritance diagram for QDomCharacterData:
+ Collaboration diagram for QDomCharacterData:

Public Member Functions

 QDomCharacterData ()
 Constructs an empty character data object.
 
 QDomCharacterData (const QDomCharacterData &characterData)
 Constructs a copy of characterData.
 
QDomCharacterDataoperator= (const QDomCharacterData &other)
 Assigns other to this character data.
 
QString substringData (unsigned long offset, unsigned long count)
 Returns the substring of length count from position offset.
 
void appendData (const QString &arg)
 Appends the string arg to the stored string.
 
void insertData (unsigned long offset, const QString &arg)
 Inserts the string arg into the stored string at position offset.
 
void deleteData (unsigned long offset, unsigned long count)
 Deletes a substring of length count from position offset.
 
void replaceData (unsigned long offset, unsigned long count, const QString &arg)
 Replaces the substring of length count starting at position offset with the string arg.
 
int length () const
 Returns the length of the stored string.
 
QString data () const
 Returns the string stored in this object.
 
void setData (const QString &data)
 Sets this object's string to data.
 
QDomNode::NodeType nodeType () const
 Returns the type of node this object refers to (i.e.
 
- Public Member Functions inherited from QDomNode
 QDomNode ()
 Constructs a \l{isNull()}{null} node.
 
 QDomNode (const QDomNode &node)
 Constructs a copy of node.
 
QDomNodeoperator= (const QDomNode &other)
 Assigns a copy of other to this DOM node.
 
bool operator== (const QDomNode &other) const
 Returns true if other and this DOM node are equal; otherwise returns false.
 
bool operator!= (const QDomNode &other) const
 Returns true if other and this DOM node are not equal; otherwise returns false.
 
 ~QDomNode ()
 Destroys the object and frees its resources.
 
QDomNode insertBefore (const QDomNode &newChild, const QDomNode &refChild)
 Inserts the node newChild before the child node refChild.
 
QDomNode insertAfter (const QDomNode &newChild, const QDomNode &refChild)
 Inserts the node newChild after the child node refChild.
 
QDomNode replaceChild (const QDomNode &newChild, const QDomNode &oldChild)
 Replaces oldChild with newChild.
 
QDomNode removeChild (const QDomNode &oldChild)
 Removes oldChild from the list of children.
 
QDomNode appendChild (const QDomNode &newChild)
 Appends newChild as the node's last child.
 
bool hasChildNodes () const
 Returns true if the node has one or more children; otherwise returns false.
 
QDomNode cloneNode (bool deep=true) const
 Creates a deep (not shallow) copy of the QDomNode.
 
void normalize ()
 Calling normalize() on an element converts all its children into a standard form.
 
bool isSupported (const QString &feature, const QString &version) const
 Returns true if the DOM implementation implements the feature feature and this feature is supported by this node in the version version; otherwise returns false.
 
QString nodeName () const
 Returns the name of the node.
 
NodeType nodeType () const
 Returns the type of the node.
 
QDomNode parentNode () const
 Returns the parent node.
 
QDomNodeList childNodes () const
 Returns a list of all direct child nodes.
 
QDomNode firstChild () const
 Returns the first child of the node.
 
QDomNode lastChild () const
 Returns the last child of the node.
 
QDomNode previousSibling () const
 Returns the previous sibling in the document tree.
 
QDomNode nextSibling () const
 Returns the next sibling in the document tree.
 
QDomNamedNodeMap attributes () const
 Returns a named node map of all attributes.
 
QDomDocument ownerDocument () const
 Returns the document to which this node belongs.
 
QString namespaceURI () const
 Returns the namespace URI of this node or an empty string if the node has no namespace URI.
 
QString localName () const
 If the node uses namespaces, this function returns the local name of the node; otherwise it returns an empty string.
 
bool hasAttributes () const
 Returns true if the node has attributes; otherwise returns false.
 
QString nodeValue () const
 Returns the value of the node.
 
void setNodeValue (const QString &value)
 Sets the node's value to value.
 
QString prefix () const
 Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
 
void setPrefix (const QString &pre)
 If the node has a namespace prefix, this function changes the namespace prefix of the node to pre.
 
bool isAttr () const
 Returns true if the node is an attribute; otherwise returns false.
 
bool isCDATASection () const
 Returns true if the node is a CDATA section; otherwise returns false.
 
bool isDocumentFragment () const
 Returns true if the node is a document fragment; otherwise returns false.
 
bool isDocument () const
 Returns true if the node is a document; otherwise returns false.
 
bool isDocumentType () const
 Returns true if the node is a document type; otherwise returns false.
 
bool isElement () const
 Returns true if the node is an element; otherwise returns false.
 
bool isEntityReference () const
 Returns true if the node is an entity reference; otherwise returns false.
 
bool isText () const
 Returns true if the node is a text node; otherwise returns false.
 
bool isEntity () const
 Returns true if the node is an entity; otherwise returns false.
 
bool isNotation () const
 Returns true if the node is a notation; otherwise returns false.
 
bool isProcessingInstruction () const
 Returns true if the node is a processing instruction; otherwise returns false.
 
bool isCharacterData () const
 Returns true if the node is a character data node; otherwise returns false.
 
bool isComment () const
 Returns true if the node is a comment; otherwise returns false.
 
QDomNode namedItem (const QString &name) const
 Returns the first direct child node for which nodeName() equals name.
 
bool isNull () const
 Returns true if this node is null (i.e.
 
void clear ()
 Converts the node into a null node; if it was not a null node before, its type and contents are deleted.
 
QDomAttr toAttr () const
 Converts a QDomNode into a QDomAttr.
 
QDomCDATASection toCDATASection () const
 Converts a QDomNode into a QDomCDATASection.
 
QDomDocumentFragment toDocumentFragment () const
 Converts a QDomNode into a QDomDocumentFragment.
 
QDomDocument toDocument () const
 Converts a QDomNode into a QDomDocument.
 
QDomDocumentType toDocumentType () const
 Converts a QDomNode into a QDomDocumentType.
 
QDomElement toElement () const
 Converts a QDomNode into a QDomElement.
 
QDomEntityReference toEntityReference () const
 Converts a QDomNode into a QDomEntityReference.
 
QDomText toText () const
 Converts a QDomNode into a QDomText.
 
QDomEntity toEntity () const
 Converts a QDomNode into a QDomEntity.
 
QDomNotation toNotation () const
 Converts a QDomNode into a QDomNotation.
 
QDomProcessingInstruction toProcessingInstruction () const
 Converts a QDomNode into a QDomProcessingInstruction.
 
QDomCharacterData toCharacterData () const
 Converts a QDomNode into a QDomCharacterData.
 
QDomComment toComment () const
 Converts a QDomNode into a QDomComment.
 
void save (QTextStream &, int, EncodingPolicy=QDomNode::EncodingFromDocument) const
 Writes the XML representation of the node and all its children to the stream stream.
 
QDomElement firstChildElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the first child element with tag name tagName and namespace URI namespaceURI.
 
QDomElement lastChildElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the last child element with tag name tagName and namespace URI namespaceURI.
 
QDomElement previousSiblingElement (const QString &tagName=QString(), const QString &namespaceURI=QString()) const
 Returns the previous sibling element with tag name tagName and namespace URI namespaceURI.
 
QDomElement nextSiblingElement (const QString &taName=QString(), const QString &namespaceURI=QString()) const
 Returns the next sibling element with tag name tagName and namespace URI namespaceURI.
 
int lineNumber () const
 
int columnNumber () const
 

Friends

class QDomDocument
 
class QDomText
 
class QDomComment
 
class QDomNode
 

Additional Inherited Members

- Public Types inherited from QDomNode
enum  NodeType {
  ElementNode = 1 , AttributeNode = 2 , TextNode = 3 , CDATASectionNode = 4 ,
  EntityReferenceNode = 5 , EntityNode = 6 , ProcessingInstructionNode = 7 , CommentNode = 8 ,
  DocumentNode = 9 , DocumentTypeNode = 10 , DocumentFragmentNode = 11 , NotationNode = 12 ,
  BaseNode = 21 , CharacterDataNode = 22
}
 This enum defines the type of the node: \value ElementNode \value AttributeNode \value TextNode \value CDATASectionNode \value EntityReferenceNode \value EntityNode \value ProcessingInstructionNode \value CommentNode \value DocumentNode \value DocumentTypeNode \value DocumentFragmentNode \value NotationNode \value BaseNode A QDomNode object, i.e. More...
 
enum  EncodingPolicy { EncodingFromDocument = 1 , EncodingFromTextStream = 2 }
 
- Protected Member Functions inherited from QDomNode
 QDomNode (QDomNodePrivate *)
 
- Protected Attributes inherited from QDomNode
QDomNodePrivateimpl
 

Detailed Description

\reentrant

The QDomCharacterData class represents a generic string in the DOM.

\inmodule QtXml

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, QDomCDATASection

Definition at line 410 of file qdom.h.

Constructor & Destructor Documentation

◆ QDomCharacterData() [1/2]

QDomCharacterData::QDomCharacterData ( )

Constructs an empty character data object.

Definition at line 3421 of file qdom.cpp.

◆ QDomCharacterData() [2/2]

QDomCharacterData::QDomCharacterData ( const QDomCharacterData & characterData)

Constructs a copy of characterData.

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

Definition at line 3432 of file qdom.cpp.

Member Function Documentation

◆ appendData()

void QDomCharacterData::appendData ( const QString & arg)

Appends the string arg to the stored string.

Definition at line 3496 of file qdom.cpp.

References arg, IMPL, and QDomNode::impl.

◆ data()

QString QDomCharacterData::data ( ) const

Returns the string stored in this object.

If the node is a \l{isNull()}{null node}, it will return an empty string.

Definition at line 3457 of file qdom.cpp.

References QDomNode::impl, and QDomNodePrivate::nodeValue().

+ Here is the call graph for this function:

◆ deleteData()

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

Deletes a substring of length count from position offset.

Definition at line 3514 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ insertData()

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

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

Definition at line 3505 of file qdom.cpp.

References arg, IMPL, and QDomNode::impl.

◆ length()

int QDomCharacterData::length ( ) const

Returns the length of the stored string.

Definition at line 3476 of file qdom.cpp.

References IMPL, and QDomNode::impl.

◆ nodeType()

QDomNode::NodeType QDomCharacterData::nodeType ( ) const

Returns the type of node this object refers to (i.e.

TextNode, CDATASectionNode, CommentNode or CharacterDataNode). For a \l{isNull()}{null node}, returns CharacterDataNode.

Definition at line 3535 of file qdom.cpp.

References QDomNode::CharacterDataNode, QDomNode::impl, and QDomNode::nodeType().

+ Here is the call graph for this function:

◆ operator=()

QDomCharacterData & QDomCharacterData::operator= ( const QDomCharacterData & other)
default

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

◆ replaceData()

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.

Definition at line 3524 of file qdom.cpp.

References arg, IMPL, and QDomNode::impl.

◆ setData()

void QDomCharacterData::setData ( const QString & data)

Sets this object's string to data.

Definition at line 3467 of file qdom.cpp.

References QDomNode::impl, and QDomNodePrivate::setNodeValue().

+ Here is the call graph for this function:

◆ substringData()

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

Returns the substring of length count from position offset.

Definition at line 3486 of file qdom.cpp.

References IMPL, and QDomNode::impl.

Friends And Related Symbol Documentation

◆ QDomComment

friend class QDomComment
friend

Definition at line 439 of file qdom.h.

◆ QDomDocument

friend class QDomDocument
friend

Definition at line 437 of file qdom.h.

◆ QDomNode

friend class QDomNode
friend

Definition at line 440 of file qdom.h.

◆ QDomText

friend class QDomText
friend

Definition at line 438 of file qdom.h.


The documentation for this class was generated from the following files: