Wim van der Vegt / TINYXML

Dependents:   tinyxml_test

Embed: (wiki syntax)

« Back to documentation index

TiXmlElement Class Reference

The element is a container class. More...

#include <tinyxml.h>

Inherits TiXmlNode.

Public Types

enum  NodeType
 

The types of XML nodes supported by TinyXml.

More...

Public Member Functions

 TiXmlElement (const char *in_value)
 Construct an element.
 TiXmlElement (const std::string &_value)
 std::string constructor.
const char * Attribute (const char *name) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
const char * Attribute (const char *name, int *i) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
const char * Attribute (const char *name, double *d) const
 Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
int QueryIntAttribute (const char *name, int *_value) const
 QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking.
int QueryDoubleAttribute (const char *name, double *_value) const
 QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
int QueryFloatAttribute (const char *name, float *_value) const
 QueryFloatAttribute examines the attribute - see QueryIntAttribute().
int QueryStringAttribute (const char *name, std::string *_value) const
 QueryStringAttribute examines the attribute - see QueryIntAttribute().
template<typename T >
int QueryValueAttribute (const std::string &name, T *outValue) const
 Template form of the attribute query which will try to read the attribute into the specified type.
void SetAttribute (const char *name, const char *_value)
 Sets an attribute of name to a given value.
void SetAttribute (const std::string &name, const std::string &_value)
void SetAttribute (const std::string &name, int _value)
 STL std::string form.
void SetAttribute (const char *name, int value)
 Sets an attribute of name to a given value.
void SetDoubleAttribute (const char *name, double value)
 Sets an attribute of name to a given value.
void RemoveAttribute (const char *name)
 Deletes an attribute with the given name.
void RemoveAttribute (const std::string &name)
 STL std::string form.
const TiXmlAttributeFirstAttribute () const
 Access the first attribute in this element.
const TiXmlAttributeLastAttribute () const
 Access the last attribute in this element.
const char * GetText () const
 Convenience function for easy access to the text inside an element.
virtual TiXmlNodeClone () const
 Creates a new Element and returns it - the returned element is a copy.
virtual void Print (FILE *cfile, int depth) const
 All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.
virtual const TiXmlElementToElement () const
 Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlElementToElement ()
 Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept (TiXmlVisitor *visitor) const
 Walk the XML tree visiting this node and all of its children.
const char * Value () const
 The meaning of 'value' changes for the specific type of TiXmlNode.
const std::string & ValueStr () const
 Return Value() as a std::string.
void SetValue (const char *_value)
 Changes the value of the node.
void SetValue (const std::string &_value)
 STL std::string form.
void Clear ()
 Delete all the children of this node. Does not affect 'this'.
TiXmlNodeParent ()
 One step up the DOM.
const TiXmlNodeFirstChild () const
 The first child of this node. Will be null if there are no children.
const TiXmlNodeFirstChild (const char *value) const
 The first child of this node with the matching 'value'.
TiXmlNodeFirstChild (const char *_value)
 The first child of this node with the matching 'value'. Will be null if none found.
const TiXmlNodeFirstChild (const std::string &_value) const
 STL std::string form.
TiXmlNodeFirstChild (const std::string &_value)
 STL std::string form.
TiXmlNodeLastChild ()
 The last child of this node. Will be null if there are no children.
TiXmlNodeLastChild (const char *_value)
 The last child of this node matching 'value'. Will be null if there are no children.
const TiXmlNodeLastChild (const std::string &_value) const
 STL std::string form.
TiXmlNodeLastChild (const std::string &_value)
 STL std::string form.
const TiXmlNodeIterateChildren (const TiXmlNode *previous) const
 An alternate way to walk the children of a node.
const TiXmlNodeIterateChildren (const char *value, const TiXmlNode *previous) const
 This flavor of IterateChildren searches for children with a particular 'value'.
const TiXmlNodeIterateChildren (const std::string &_value, const TiXmlNode *previous) const
 STL std::string form.
TiXmlNodeIterateChildren (const std::string &_value, const TiXmlNode *previous)
 STL std::string form.
TiXmlNodeInsertEndChild (const TiXmlNode &addThis)
 Add a new node related to this.
TiXmlNodeLinkEndChild (TiXmlNode *addThis)
 Add a new node related to this.
TiXmlNodeInsertBeforeChild (TiXmlNode *beforeThis, const TiXmlNode &addThis)
 Add a new node related to this.
TiXmlNodeInsertAfterChild (TiXmlNode *afterThis, const TiXmlNode &addThis)
 Add a new node related to this.
TiXmlNodeReplaceChild (TiXmlNode *replaceThis, const TiXmlNode &withThis)
 Replace a child of this node.
bool RemoveChild (TiXmlNode *removeThis)
 Delete a child of this node.
const TiXmlNodePreviousSibling () const
 Navigate to a sibling node.
const TiXmlNodePreviousSibling (const char *) const
 Navigate to a sibling node.
const TiXmlNodePreviousSibling (const std::string &_value) const
 STL std::string form.
TiXmlNodePreviousSibling (const std::string &_value)
 STL std::string form.
const TiXmlNodeNextSibling (const std::string &_value) const
 STL std::string form.
TiXmlNodeNextSibling (const std::string &_value)
 STL std::string form.
const TiXmlNodeNextSibling () const
 Navigate to a sibling node.
const TiXmlNodeNextSibling (const char *) const
 Navigate to a sibling node with the given 'value'.
const TiXmlElementNextSiblingElement () const
 Convenience function to get through elements.
const TiXmlElementNextSiblingElement (const char *) const
 Convenience function to get through elements.
const TiXmlElementNextSiblingElement (const std::string &_value) const
 STL std::string form.
TiXmlElementNextSiblingElement (const std::string &_value)
 STL std::string form.
const TiXmlElementFirstChildElement () const
 Convenience function to get through elements.
const TiXmlElementFirstChildElement (const char *_value) const
 Convenience function to get through elements.
const TiXmlElementFirstChildElement (const std::string &_value) const
 STL std::string form.
TiXmlElementFirstChildElement (const std::string &_value)
 STL std::string form.
int Type () const
 Query the type (as an enumerated value, above) of this node.
const TiXmlDocumentGetDocument () const
 Return a pointer to the Document this node lives in.
bool NoChildren () const
 Returns true if this node has no children.
virtual const TiXmlDocumentToDocument () const
 Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlDocumentToDocument ()
 Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlCommentToComment () const
 Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlCommentToComment ()
 Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlUnknownToUnknown () const
 Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlUnknownToUnknown ()
 Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlTextToText () const
 Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlTextToText ()
 Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlDeclarationToDeclaration () const
 Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlDeclarationToDeclaration ()
 Cast to a more defined type. Will return null if not of the requested type.
int Row () const
 Return the position, in the original source file, of this node or attribute.
int Column () const
 See Row()
void SetUserData (void *user)
 Set a pointer to arbitrary user data.
void * GetUserData ()
 Get a pointer to arbitrary user data.
const void * GetUserData () const
 Get a pointer to arbitrary user data.

Static Public Member Functions

static void SetCondenseWhiteSpace (bool condense)
 The world does not agree on whether white space should be kept or not.
static bool IsWhiteSpaceCondensed ()
 Return the current white space setting.
static void EncodeString (const TIXML_STRING &str, TIXML_STRING *out)
 Expands entities in a string.

Protected Attributes

void * userData
 Field containing a generic user pointer.

Friends

std::istream & operator>> (std::istream &in, TiXmlNode &base)
 An input stream operator, for every class.
std::ostream & operator<< (std::ostream &out, const TiXmlNode &base)
 An output stream operator, for every class.
std::string & operator<< (std::string &out, const TiXmlNode &base)
 Appends the XML node or attribute to a std::string.

Detailed Description

The element is a container class.

It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes.

Definition at line 942 of file tinyxml.h.


Member Enumeration Documentation

enum NodeType [inherited]

The types of XML nodes supported by TinyXml.

(All the unsupported types are picked up by UNKNOWN.)

Definition at line 464 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlElement ( const char *  in_value )

Construct an element.

Definition at line 520 of file tinyxml.cpp.

TiXmlElement ( const std::string &  _value )

std::string constructor.

Definition at line 529 of file tinyxml.cpp.


Member Function Documentation

bool Accept ( TiXmlVisitor visitor ) const [virtual]

Walk the XML tree visiting this node and all of its children.

Implements TiXmlNode.

Definition at line 830 of file tinyxml.cpp.

const char * Attribute ( const char *  name ) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

Definition at line 571 of file tinyxml.cpp.

const char * Attribute ( const char *  name,
double *  d 
) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

If the attribute exists and can be converted to an double, the double value will be put in the return 'd', if 'd' is non-null.

Definition at line 623 of file tinyxml.cpp.

const char * Attribute ( const char *  name,
int *  i 
) const

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

If the attribute exists and can be converted to an integer, the integer value will be put in the return 'i', if 'i' is non-null.

Definition at line 591 of file tinyxml.cpp.

void Clear (  ) [inherited]

Delete all the children of this node. Does not affect 'this'.

Definition at line 168 of file tinyxml.cpp.

TiXmlNode * Clone (  ) const [virtual]

Creates a new Element and returns it - the returned element is a copy.

Implements TiXmlNode.

Definition at line 844 of file tinyxml.cpp.

int Column (  ) const [inherited]

See Row()

Definition at line 247 of file tinyxml.h.

void EncodeString ( const TIXML_STRING &  str,
TIXML_STRING *  out 
) [static, inherited]

Expands entities in a string.

Note this should not contian the tag's '<', '>', etc, or they will be transformed into entities!

Definition at line 51 of file tinyxml.cpp.

const TiXmlAttribute* FirstAttribute (  ) const

Access the first attribute in this element.

Definition at line 1079 of file tinyxml.h.

const TiXmlNode* FirstChild (  ) const [inherited]

The first child of this node. Will be null if there are no children.

Definition at line 524 of file tinyxml.h.

const TiXmlNode * FirstChild ( const char *  value ) const [inherited]

The first child of this node with the matching 'value'.

Will be null if none found.

Definition at line 356 of file tinyxml.cpp.

TiXmlNode* FirstChild ( const char *  _value ) [inherited]

The first child of this node with the matching 'value'. Will be null if none found.

Definition at line 528 of file tinyxml.h.

const TiXmlNode* FirstChild ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 542 of file tinyxml.h.

TiXmlNode* FirstChild ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 543 of file tinyxml.h.

const TiXmlElement * FirstChildElement (  ) const [inherited]

Convenience function to get through elements.

Definition at line 447 of file tinyxml.cpp.

const TiXmlElement * FirstChildElement ( const char *  _value ) const [inherited]

Convenience function to get through elements.

Definition at line 462 of file tinyxml.cpp.

const TiXmlElement* FirstChildElement ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 678 of file tinyxml.h.

TiXmlElement* FirstChildElement ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 679 of file tinyxml.h.

const TiXmlDocument * GetDocument (  ) const [inherited]

Return a pointer to the Document this node lives in.

Returns null if not in a document.

Definition at line 507 of file tinyxml.cpp.

const char * GetText (  ) const

Convenience function for easy access to the text inside an element.

Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly.

If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned.

This is a convenient method for getting the text of simple contained text:

        <foo>This is text</foo>
        const char* str = fooElement->GetText();
        

'str' will be a pointer to "This is text".

Note that this function can be misleading. If the element foo was created from this XML:

        <foo><b>This is text</b></foo> 
        

then the value of str would be null. The first child node isn't a text node, it is another element. From this XML:

        <foo>This is <b>text</b></foo> 
        

GetText() will return "This is ".

WARNING: GetText() accesses a child node - don't become confused with the similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node.

Definition at line 855 of file tinyxml.cpp.

void* GetUserData (  ) [inherited]

Get a pointer to arbitrary user data.

Definition at line 250 of file tinyxml.h.

const void* GetUserData (  ) const [inherited]

Get a pointer to arbitrary user data.

Definition at line 251 of file tinyxml.h.

TiXmlNode * InsertAfterChild ( TiXmlNode afterThis,
const TiXmlNode addThis 
) [inherited]

Add a new node related to this.

Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured.

Definition at line 259 of file tinyxml.cpp.

TiXmlNode * InsertBeforeChild ( TiXmlNode beforeThis,
const TiXmlNode addThis 
) [inherited]

Add a new node related to this.

Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured.

Definition at line 227 of file tinyxml.cpp.

TiXmlNode * InsertEndChild ( const TiXmlNode addThis ) [inherited]

Add a new node related to this.

Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured.

Definition at line 212 of file tinyxml.cpp.

static bool IsWhiteSpaceCondensed (  ) [static, inherited]

Return the current white space setting.

Definition at line 226 of file tinyxml.h.

TiXmlNode* IterateChildren ( const std::string &  _value,
const TiXmlNode previous 
) [inherited]

STL std::string form.

Definition at line 577 of file tinyxml.h.

const TiXmlNode* IterateChildren ( const std::string &  _value,
const TiXmlNode previous 
) const [inherited]

STL std::string form.

Definition at line 576 of file tinyxml.h.

const TiXmlNode * IterateChildren ( const char *  value,
const TiXmlNode previous 
) const [inherited]

This flavor of IterateChildren searches for children with a particular 'value'.

Definition at line 394 of file tinyxml.cpp.

const TiXmlNode * IterateChildren ( const TiXmlNode previous ) const [inherited]

An alternate way to walk the children of a node.

One way to iterate over nodes is:

            for( child = parent->FirstChild(); child; child = child->NextSibling() )
        

IterateChildren does the same thing with the syntax:

            child = 0;
            while( child = parent->IterateChildren( child ) )
        

IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done.

Definition at line 380 of file tinyxml.cpp.

const TiXmlAttribute* LastAttribute (  ) const

Access the last attribute in this element.

Definition at line 1081 of file tinyxml.h.

TiXmlNode* LastChild ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 545 of file tinyxml.h.

TiXmlNode* LastChild (  ) [inherited]

The last child of this node. Will be null if there are no children.

Definition at line 534 of file tinyxml.h.

TiXmlNode* LastChild ( const char *  _value ) [inherited]

The last child of this node matching 'value'. Will be null if there are no children.

Definition at line 537 of file tinyxml.h.

const TiXmlNode* LastChild ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 544 of file tinyxml.h.

TiXmlNode * LinkEndChild ( TiXmlNode addThis ) [inherited]

Add a new node related to this.

Adds a child past the LastChild.

NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.

See also:
InsertEndChild

Definition at line 185 of file tinyxml.cpp.

const TiXmlNode* NextSibling ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 628 of file tinyxml.h.

TiXmlNode* NextSibling ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 629 of file tinyxml.h.

const TiXmlNode* NextSibling (  ) const [inherited]

Navigate to a sibling node.

Definition at line 633 of file tinyxml.h.

const TiXmlNode * NextSibling ( const char *  _value ) const [inherited]

Navigate to a sibling node with the given 'value'.

Definition at line 408 of file tinyxml.cpp.

const TiXmlElement * NextSiblingElement (  ) const [inherited]

Convenience function to get through elements.

Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

Definition at line 477 of file tinyxml.cpp.

const TiXmlElement * NextSiblingElement ( const char *  _value ) const [inherited]

Convenience function to get through elements.

Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.

Definition at line 492 of file tinyxml.cpp.

const TiXmlElement* NextSiblingElement ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 661 of file tinyxml.h.

TiXmlElement* NextSiblingElement ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 662 of file tinyxml.h.

bool NoChildren (  ) const [inherited]

Returns true if this node has no children.

Definition at line 697 of file tinyxml.h.

TiXmlNode* Parent (  ) [inherited]

One step up the DOM.

Definition at line 521 of file tinyxml.h.

const TiXmlNode* PreviousSibling (  ) const [inherited]

Navigate to a sibling node.

Definition at line 616 of file tinyxml.h.

const TiXmlNode * PreviousSibling ( const char *  _value ) const [inherited]

Navigate to a sibling node.

Definition at line 420 of file tinyxml.cpp.

TiXmlNode* PreviousSibling ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 627 of file tinyxml.h.

const TiXmlNode* PreviousSibling ( const std::string &  _value ) const [inherited]

STL std::string form.

Definition at line 626 of file tinyxml.h.

void Print ( FILE *  cfile,
int  depth 
) const [virtual]

All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null.

This is a formatted print, and will insert tabs and newlines.

(For an unformatted stream, use the << operator.)

Implements TiXmlBase.

Definition at line 755 of file tinyxml.cpp.

int QueryDoubleAttribute ( const char *  name,
double *  _value 
) const

QueryDoubleAttribute examines the attribute - see QueryIntAttribute().

Definition at line 675 of file tinyxml.cpp.

int QueryFloatAttribute ( const char *  name,
float *  _value 
) const

QueryFloatAttribute examines the attribute - see QueryIntAttribute().

Definition at line 991 of file tinyxml.h.

int QueryIntAttribute ( const char *  name,
int *  _value 
) const

QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking.

If the attribute is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. If the attribute does not exist, then TIXML_NO_ATTRIBUTE is returned.

Definition at line 655 of file tinyxml.cpp.

int QueryStringAttribute ( const char *  name,
std::string *  _value 
) const

QueryStringAttribute examines the attribute - see QueryIntAttribute().

Definition at line 1002 of file tinyxml.h.

int QueryValueAttribute ( const std::string &  name,
T *  outValue 
) const

Template form of the attribute query which will try to read the attribute into the specified type.

Very easy, very powerful, but be careful to make sure to call this with the correct type.

NOTE: This method doesn't work correctly for 'string' types that contain spaces.

Returns:
TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE

Definition at line 1019 of file tinyxml.h.

void RemoveAttribute ( const std::string &  name )

STL std::string form.

Definition at line 1076 of file tinyxml.h.

void RemoveAttribute ( const char *  name )

Deletes an attribute with the given name.

Definition at line 432 of file tinyxml.cpp.

bool RemoveChild ( TiXmlNode removeThis ) [inherited]

Delete a child of this node.

Definition at line 330 of file tinyxml.cpp.

TiXmlNode * ReplaceChild ( TiXmlNode replaceThis,
const TiXmlNode withThis 
) [inherited]

Replace a child of this node.

Returns a pointer to the new object or NULL if an error occured.

Definition at line 291 of file tinyxml.cpp.

int Row (  ) const [inherited]

Return the position, in the original source file, of this node or attribute.

The row and column are 1-based. (That is the first row and first column is 1,1). If the returns values are 0 or less, then the parser does not have a row and column value.

Generally, the row and column value will be set when the TiXmlDocument::Load(), TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set when the DOM was created from operator>>.

The values reflect the initial load. Once the DOM is modified programmatically (by adding or changing nodes and attributes) the new values will NOT update to reflect changes in the document.

There is a minor performance cost to computing the row and column. Computation can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.

See also:
TiXmlDocument::SetTabSize()

Definition at line 246 of file tinyxml.h.

void SetAttribute ( const std::string &  name,
int  _value 
)

STL std::string form.

Definition at line 705 of file tinyxml.cpp.

void SetAttribute ( const std::string &  name,
const std::string &  _value 
)

STL std::string form.

Definition at line 745 of file tinyxml.cpp.

void SetAttribute ( const char *  name,
int  value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 695 of file tinyxml.cpp.

void SetAttribute ( const char *  name,
const char *  _value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 735 of file tinyxml.cpp.

static void SetCondenseWhiteSpace ( bool  condense ) [static, inherited]

The world does not agree on whether white space should be kept or not.

In order to make everyone happy, these global, static functions are provided to set whether or not TinyXml will condense all white space into a single space or not. The default is to condense. Note changing this value is not thread safe.

Definition at line 223 of file tinyxml.h.

void SetDoubleAttribute ( const char *  name,
double  value 
)

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does.

Definition at line 715 of file tinyxml.cpp.

void SetUserData ( void *  user ) [inherited]

Set a pointer to arbitrary user data.

Definition at line 249 of file tinyxml.h.

void SetValue ( const std::string &  _value ) [inherited]

STL std::string form.

Definition at line 514 of file tinyxml.h.

void SetValue ( const char *  _value ) [inherited]

Changes the value of the node.

Defined as:

        Document:    filename of the xml file
        Element:    name of the element
        Comment:    the comment text
        Unknown:    the tag contents
        Text:        the text string
        

Definition at line 510 of file tinyxml.h.

virtual const TiXmlComment* ToComment (  ) const [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlComment.

Definition at line 701 of file tinyxml.h.

virtual TiXmlComment* ToComment (  ) [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlComment.

Definition at line 708 of file tinyxml.h.

virtual TiXmlDeclaration* ToDeclaration (  ) [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDeclaration.

Definition at line 711 of file tinyxml.h.

virtual const TiXmlDeclaration* ToDeclaration (  ) const [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDeclaration.

Definition at line 704 of file tinyxml.h.

virtual TiXmlDocument* ToDocument (  ) [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDocument.

Definition at line 706 of file tinyxml.h.

virtual const TiXmlDocument* ToDocument (  ) const [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlDocument.

Definition at line 699 of file tinyxml.h.

virtual const TiXmlElement* ToElement (  ) const [virtual]

Cast to a more defined type. Will return null not of the requested type.

Reimplemented from TiXmlNode.

Definition at line 1128 of file tinyxml.h.

virtual TiXmlElement* ToElement (  ) [virtual]

Cast to a more defined type. Will return null not of the requested type.

Reimplemented from TiXmlNode.

Definition at line 1129 of file tinyxml.h.

virtual const TiXmlText* ToText (  ) const [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlText.

Definition at line 703 of file tinyxml.h.

virtual TiXmlText* ToText (  ) [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlText.

Definition at line 710 of file tinyxml.h.

virtual TiXmlUnknown* ToUnknown (  ) [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlUnknown.

Definition at line 709 of file tinyxml.h.

virtual const TiXmlUnknown* ToUnknown (  ) const [virtual, inherited]

Cast to a more defined type. Will return null if not of the requested type.

Reimplemented in TiXmlUnknown.

Definition at line 702 of file tinyxml.h.

int Type (  ) const [inherited]

Query the type (as an enumerated value, above) of this node.

The possible types are: DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, and DECLARATION.

Definition at line 686 of file tinyxml.h.

const char* Value (  ) const [inherited]

The meaning of 'value' changes for the specific type of TiXmlNode.

        Document:    filename of the xml file
        Element:    name of the element
        Comment:    the comment text
        Unknown:    the tag contents
        Text:        the text string
        

The subclasses will wrap this function.

Definition at line 489 of file tinyxml.h.

const std::string& ValueStr (  ) const [inherited]

Return Value() as a std::string.

If you only use STL, this is more efficient than calling Value(). Only available in STL mode.

Definition at line 496 of file tinyxml.h.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const TiXmlNode base 
) [friend, inherited]

An output stream operator, for every class.

Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines.

The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines.

But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is true of all input streams, but it's worth keeping in mind.

A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element.

Definition at line 1561 of file tinyxml.cpp.

std::string& operator<< ( std::string &  out,
const TiXmlNode base 
) [friend, inherited]

Appends the XML node or attribute to a std::string.

Definition at line 1572 of file tinyxml.cpp.

std::istream& operator>> ( std::istream &  in,
TiXmlNode base 
) [friend, inherited]

An input stream operator, for every class.

Tolerant of newlines and formatting, but doesn't expect them.

Definition at line 1548 of file tinyxml.cpp.


Field Documentation

void* userData [protected, inherited]

Field containing a generic user pointer.

Definition at line 378 of file tinyxml.h.