Qt 4.8
Public Functions | Private Functions | Friends | List of all members
QDomCharacterData Class Reference

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

#include <qdom.h>

Inheritance diagram for QDomCharacterData:
QDomNode QDomComment QDomText QDomCDATASection

Public Functions

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

Private Functions

 QDomCharacterData (QDomCharacterDataPrivate *)
 

Friends

class QDomComment
 
class QDomDocument
 
class QDomNode
 
class QDomText
 

Additional Inherited Members

- Public Types inherited from QDomNode
enum  EncodingPolicy { EncodingFromDocument = 1, EncodingFromTextStream = 2 }
 This enum specifies how QDomNode::save() determines what encoding to use when serializing. More...
 
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: More...
 
- Protected Functions inherited from QDomNode
 QDomNode (QDomNodePrivate *)
 Constructs a new node for the data n. More...
 
- Protected Variables inherited from QDomNode
QDomNodePrivateimpl
 

Detailed Description

The QDomCharacterData class represents a generic string in the DOM.

Note
This class or function is reentrant.
Attention
Module: 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 416 of file qdom.h.

Constructors and Destructors

◆ QDomCharacterData() [1/3]

QDomCharacterData::QDomCharacterData ( )

Constructs an empty character data object.

Definition at line 4056 of file qdom.cpp.

4057 {
4058 }

◆ QDomCharacterData() [2/3]

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

Definition at line 4067 of file qdom.cpp.

4068  : QDomNode(x)
4069 {
4070 }
QDomNode()
Constructs a null node.
Definition: qdom.cpp:2057

◆ QDomCharacterData() [3/3]

QDomCharacterData::QDomCharacterData ( QDomCharacterDataPrivate n)
private

Definition at line 4072 of file qdom.cpp.

4073  : QDomNode(n)
4074 {
4075 }
QDomNode()
Constructs a null node.
Definition: qdom.cpp:2057

Functions

◆ appendData()

void QDomCharacterData::appendData ( const QString arg)

Appends the string arg to the stored string.

Definition at line 4134 of file qdom.cpp.

4135 {
4136  if (impl)
4137  IMPL->appendData(arg);
4138 }
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

◆ data()

QString QDomCharacterData::data ( ) const

Returns the string stored in this object.

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

Definition at line 4095 of file qdom.cpp.

4096 {
4097  if (!impl)
4098  return QString();
4099  return impl->nodeValue();
4100 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString nodeValue() const
Definition: qdom.cpp:143
QDomNodePrivate * impl
Definition: qdom.h:243

◆ deleteData()

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

Deletes a substring of length count from position offset.

Definition at line 4152 of file qdom.cpp.

4153 {
4154  if (impl)
4155  IMPL->deleteData(offset, count);
4156 }
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

◆ insertData()

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

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

Definition at line 4143 of file qdom.cpp.

4144 {
4145  if (impl)
4146  IMPL->insertData(offset, arg);
4147 }
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

◆ length()

uint QDomCharacterData::length ( ) const

Returns the length of the stored string.

Definition at line 4114 of file qdom.cpp.

4115 {
4116  if (impl)
4117  return IMPL->dataLength();
4118  return 0;
4119 }
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

◆ nodeType()

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.

Definition at line 4173 of file qdom.cpp.

4174 {
4175  if (!impl)
4176  return CharacterDataNode;
4177  return QDomNode::nodeType();
4178 }
NodeType nodeType() const
Returns the type of the node.
Definition: qdom.cpp:2256
QDomNodePrivate * impl
Definition: qdom.h:243

◆ operator=()

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

Definition at line 4084 of file qdom.cpp.

4085 {
4087 }
QDomNode & operator=(const QDomNode &)
Assigns a copy of n to this DOM node.
Definition: qdom.cpp:2096
The QDomCharacterData class represents a generic string in the DOM.
Definition: qdom.h:416

◆ 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 4162 of file qdom.cpp.

4163 {
4164  if (impl)
4165  IMPL->replaceData(offset, count, arg);
4166 }
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

◆ setData()

void QDomCharacterData::setData ( const QString v)

Sets this object's string to v.

Definition at line 4105 of file qdom.cpp.

4106 {
4107  if (impl)
4108  impl->setNodeValue(v);
4109 }
QDomNodePrivate * impl
Definition: qdom.h:243
virtual void setNodeValue(const QString &v)
Definition: qdom.cpp:144

◆ substringData()

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

Returns the substring of length count from position offset.

Definition at line 4124 of file qdom.cpp.

4125 {
4126  if (!impl)
4127  return QString();
4128  return IMPL->substringData(offset, count);
4129 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QDomNodePrivate * impl
Definition: qdom.h:243
#define IMPL
Definition: qdom.cpp:6666

Friends and Related Functions

◆ QDomComment

friend class QDomComment
friend

Definition at line 445 of file qdom.h.

Referenced by QDomComment::nodeType().

◆ QDomDocument

friend class QDomDocument
friend

Definition at line 443 of file qdom.h.

◆ QDomNode

friend class QDomNode
friend

Definition at line 446 of file qdom.h.

◆ QDomText

friend class QDomText
friend

Definition at line 444 of file qdom.h.

Referenced by QDomText::nodeType().


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