Class XMLText

Synopsis

#include <tinyxml2.h>

class TINYXML2_LIB XMLText : public XMLNode

Description

XML text.

Note that a text node can have child element nodes, for example:


<root>This is <b>bold</b></root>

A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCData() and query it with CData().

Mentioned in

Inheritance

Ancestors: XMLNode

Methods

XMLText Overload
~XMLText
AcceptAccept a hierarchical visit of the nodes in the TinyXML-2 DOM
CDataReturns true if this is a CDATA text element.
ParseDeep
SetCDataDeclare whether this should be CDATA or standard text.
ShallowCloneMake a copy of this node, but not its children
ShallowEqualTest if 2 nodes are the same, but don't test children
ToText OverloadSafely cast to Text, or null.

Source

Lines 990-1026 in tinyxml2.h.

class TINYXML2_LIB XMLText : public XMLNode
{
    friend class XMLDocument;
public:
    virtual bool Accept( XMLVisitor* visitor ) const;

    virtual XMLText* ToText()           {
        return this;
    }
    virtual const XMLText* ToText() const   {
        return this;
    }

    /// Declare whether this should be CDATA or standard text.
    void SetCData( bool isCData )           {
        _isCData = isCData;
    }
    /// Returns true if this is a CDATA text element.
    bool CData() const                      {
        return _isCData;
    }

    virtual XMLNode* ShallowClone( XMLDocument* document ) const;
    virtual bool ShallowEqual( const XMLNode* compare ) const;

protected:
    explicit XMLText( XMLDocument* doc )    : XMLNode( doc ), _isCData( false ) {}
    virtual ~XMLText()                                              {}

    char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );

private:
    bool _isCData;

    XMLText( const XMLText& );  // not supported
    XMLText& operator=( const XMLText& );   // not supported
};





Add Discussion as Guest

Log in