tinystr.h   tinystr.h 
skipping to change at line 75 skipping to change at line 75
// Convert a TiXmlString into a classical char * // Convert a TiXmlString into a classical char *
const char * c_str () const const char * c_str () const
{ {
if (allocated) if (allocated)
return cstring; return cstring;
return ""; return "";
} }
// Return the length of a TiXmlString // Return the length of a TiXmlString
unsigned length () const; unsigned length () const
{
return ( allocated ) ? current_length : 0;
}
// TiXmlString = operator // TiXmlString = operator
void operator = (const char * content); void operator = (const char * content);
// = operator // = operator
void operator = (const TiXmlString & copy); void operator = (const TiXmlString & copy);
// += operator. Maps to append // += operator. Maps to append
TiXmlString& operator += (const char * suffix) TiXmlString& operator += (const char * suffix)
{ {
 End of changes. 1 change blocks. 
1 lines changed or deleted 4 lines changed or added


 tinyxml.h   tinyxml.h 
skipping to change at line 51 skipping to change at line 51
#define DEBUG #define DEBUG
#endif #endif
#if defined( DEBUG ) && defined( _MSC_VER ) #if defined( DEBUG ) && defined( _MSC_VER )
#include <windows.h> #include <windows.h>
#define TIXML_LOG OutputDebugString #define TIXML_LOG OutputDebugString
#else #else
#define TIXML_LOG printf #define TIXML_LOG printf
#endif #endif
// Uncomment the following definition for Apple's Project Builder
// #define TIXML_NEED_STREAM
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
#include <string> #include <string>
#ifdef TIXML_NEED_STREAM #include <iostream>
#include <istream> //#include <ostream>
#include <ostream>
#endif
#define TIXML_STRING std::string #define TIXML_STRING std::string
#define TIXML_ISTREAM std::istream #define TIXML_ISTREAM std::istream
#define TIXML_OSTREAM std::ostream #define TIXML_OSTREAM std::ostream
#else #else
#include "tinystr.h" #include "tinystr.h"
#define TIXML_STRING TiXmlString #define TIXML_STRING TiXmlString
#define TIXML_OSTREAM TiXmlOutStream #define TIXML_OSTREAM TiXmlOutStream
#endif #endif
class TiXmlDocument; class TiXmlDocument;
class TiXmlElement; class TiXmlElement;
class TiXmlComment; class TiXmlComment;
class TiXmlUnknown; class TiXmlUnknown;
class TiXmlAttribute; class TiXmlAttribute;
class TiXmlText; class TiXmlText;
class TiXmlDeclaration; class TiXmlDeclaration;
class TiXmlParsingData;
/* Internal structure for tracking location of items
in the XML file.
*/
struct TiXmlCursor
{
TiXmlCursor() { Clear(); }
void Clear() { row = col = -1; }
int row; // 0 based.
int col; // 0 based.
};
// Only used by Attribute::Query functions
enum
{
TIXML_SUCCESS,
TIXML_NO_ATTRIBUTE,
TIXML_WRONG_TYPE
};
/** TiXmlBase is a base class for every class in TinyXml. /** TiXmlBase is a base class for every class in TinyXml.
It does little except to establish that TinyXml classes It does little except to establish that TinyXml classes
can be printed and provide some utility functions. can be printed and provide some utility functions.
In XML, the document and elements can contain In XML, the document and elements can contain
other elements and other types of nodes. other elements and other types of nodes.
@verbatim @verbatim
A Document can contain: Element (container or leaf) A Document can contain: Element (container or leaf)
Comment (leaf) Comment (leaf)
skipping to change at line 119 skipping to change at line 136
/** All TinyXml classes can print themselves to a filestream. /** All TinyXml classes can print themselves to a filestream.
This is a formatted print, and will insert tabs and newlines . This is a formatted print, and will insert tabs and newlines .
(For an unformatted stream, use the << operator.) (For an unformatted stream, use the << operator.)
*/ */
virtual void Print( FILE* cfile, int depth ) const = 0; virtual void Print( FILE* cfile, int depth ) const = 0;
/** The world does not agree on whether white space should be ke pt or /** The world does not agree on whether white space should be ke pt or
not. In order to make everyone happy, these global, static f unctions not. In order to make everyone happy, these global, static f unctions
are provided to set whether or not TinyXml will condense all white space 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 these into a single space or not. The default is to condense. Note changing this
values is not thread safe. values is not thread safe.
*/ */
static void SetCondenseWhiteSpace( bool condense ) { co ndenseWhiteSpace = condense; } static void SetCondenseWhiteSpace( bool condense ) { co ndenseWhiteSpace = condense; }
/// Return the current white space setting. /// Return the current white space setting.
static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
/** Return the position, in the original source file, of this node o
r attribute.
The row and column are 1-based. (That is the first row and f
irst column is
1,1). If the returns values are 0 or less, then the parser d
oes not have
a row and column value.
Generally, the row and column value will be set when the TiX
mlDocument::Load(),
TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is call
ed. It will NOT be set
when the DOM was created from operator>>.
The values reflect the initial load. Once the DOM is modifie
d 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 c
olumn. Computation
can be disabled if TiXmlDocument::SetTabSize() is called wit
h 0 as the value.
@sa TiXmlDocument::SetTabSize()
*/
int Row() const { return location.row + 1; }
int Column() const { return location.col + 1; } ///<
See Row()
protected: protected:
// See STL_STRING_BUG // See STL_STRING_BUG
// Utility class to overcome a bug. // Utility class to overcome a bug.
class StringToBuffer class StringToBuffer
{ {
public: public:
StringToBuffer( const TIXML_STRING& str ); StringToBuffer( const TIXML_STRING& str );
~StringToBuffer(); ~StringToBuffer();
char* buffer; char* buffer;
}; };
skipping to change at line 162 skipping to change at line 200
static const char* ReadName( const char* p, TIXML_STRING* name ); static const char* ReadName( const char* p, TIXML_STRING* name );
/* Reads text. Returns a pointer past the given end tag. /* Reads text. Returns a pointer past the given end tag.
Wickedly complex options, but it keeps the (sensitive) code in one place. Wickedly complex options, but it keeps the (sensitive) code in one place.
*/ */
static const char* ReadText( const char* in, // where to start static const char* ReadText( const char* in, // where to start
TIXM L_STRING* text, // the string read TIXM L_STRING* text, // the string read
bool ignoreWhiteSpace, // whether to keep the white space bool ignoreWhiteSpace, // whether to keep the white space
cons t char* endTag, // what ends this text cons t char* endTag, // what ends this text
bool ignoreCase ); // whether to ignore case in the end ta g bool ignoreCase ); // whether to ignore case in the end ta g
virtual const char* Parse( const char* p ) = 0;
virtual const char* Parse( const char* p, const TiXmlParsingData* da
ta ) = 0;
// If an entity has been found, transform it into a character. // If an entity has been found, transform it into a character.
static const char* GetEntity( const char* in, char* value ); static const char* GetEntity( const char* in, char* value );
// Get a character, while interpreting entities. // Get a character, while interpreting entities.
inline static const char* GetChar( const char* p, char* value ) inline static const char* GetChar( const char* p, char* _value )
{ {
assert( p ); assert( p );
if ( *p == '&' ) if ( *p == '&' )
{ {
return GetEntity( p, value ); return GetEntity( p, _value );
} }
else else
{ {
*value = *p; *_value = *p;
return p+1; return p+1;
} }
} }
// Puts a string to a stream, expanding entities as it goes. // Puts a string to a stream, expanding entities as it goes.
// Note this should not contian the '<', '>', etc, or they will be t ransformed into entities! // Note this should not contian the '<', '>', etc, or they will be t ransformed into entities!
static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out ) ; static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out ) ;
static void PutString( const TIXML_STRING& str, TIXML_STRING* out ); static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
// Return true if the next characters in the stream are any of the e ndTag sequences. // Return true if the next characters in the stream are any of the e ndTag sequences.
bool static StringEqual( const char* p, static bool StringEqual( const char* p,
const char* endTag, const char* endTag,
bool ignoreC ase ); bool ignoreC ase );
enum enum
{ {
TIXML_NO_ERROR = 0, TIXML_NO_ERROR = 0,
TIXML_ERROR, TIXML_ERROR,
TIXML_ERROR_OPENING_FILE, TIXML_ERROR_OPENING_FILE,
TIXML_ERROR_OUT_OF_MEMORY, TIXML_ERROR_OUT_OF_MEMORY,
TIXML_ERROR_PARSING_ELEMENT, TIXML_ERROR_PARSING_ELEMENT,
skipping to change at line 214 skipping to change at line 253
TIXML_ERROR_READING_END_TAG, TIXML_ERROR_READING_END_TAG,
TIXML_ERROR_PARSING_UNKNOWN, TIXML_ERROR_PARSING_UNKNOWN,
TIXML_ERROR_PARSING_COMMENT, TIXML_ERROR_PARSING_COMMENT,
TIXML_ERROR_PARSING_DECLARATION, TIXML_ERROR_PARSING_DECLARATION,
TIXML_ERROR_DOCUMENT_EMPTY, TIXML_ERROR_DOCUMENT_EMPTY,
TIXML_ERROR_STRING_COUNT TIXML_ERROR_STRING_COUNT
}; };
static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
TiXmlCursor location;
private: private:
struct Entity struct Entity
{ {
const char* str; const char* str;
unsigned int strLength; unsigned int strLength;
char chr; char chr;
}; };
enum enum
{ {
NUM_ENTITY = 5, NUM_ENTITY = 5,
MAX_ENTITY_LENGTH = 6 MAX_ENTITY_LENGTH = 6
}; };
static Entity entity[ NUM_ENTITY ]; static Entity entity[ NUM_ENTITY ];
static bool condenseWhiteSpace; static bool condenseWhiteSpace;
}; };
/** The parent class for everything in the Document Object Model. /** The parent class for everything in the Document Object Model.
(Except for attributes, which are contained in elements.) (Except for attributes).
Nodes have siblings, a parent, and children. A node can be Nodes have siblings, a parent, and children. A node can be
in a document, or stand on its own. The type of a TiXmlNode in a document, or stand on its own. The type of a TiXmlNode
can be queried, and it can be cast to its more defined type. can be queried, and it can be cast to its more defined type.
*/ */
class TiXmlNode : public TiXmlBase class TiXmlNode : public TiXmlBase
{ {
friend class TiXmlDocument; friend class TiXmlDocument;
friend class TiXmlElement; friend class TiXmlElement;
public: public:
skipping to change at line 263 skipping to change at line 304
The operator<< and operator>> are not completely symmetr ic. Writing The operator<< and operator>> are not completely symmetr ic. Writing
a node to a stream is very well defined. You'll get a ni ce stream a node to a stream is very well defined. You'll get a ni ce stream
of output, without any extra whitespace or newlines. of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) I f you create But reading is not as well defined. (As it always is.) I f you create
a TiXmlElement (for example) and read that from an input stream, a TiXmlElement (for example) and read that from an input stream,
the text needs to define an element or junk will result. This is the text needs to define an element or junk will result. This is
true of all input streams, but it's worth keeping in min d. true of all input streams, but it's worth keeping in min d.
A TiXmlDocument will read nodes until it reads a root el A TiXmlDocument will read nodes until it reads a root el
ement. ement, and
all the children of that root element.
*/ */
friend std::ostream & operator<< (std::ostream& out, const TiXml friend std::ostream& operator<< (std::ostream& out, const TiXmlN
Node& base); ode& base);
/// Appends the XML node or attribute to a std::string.
friend std::string& operator<< (std::string& out, const TiXm
lNode& base );
#else #else
// Used internally, not part of the public API. // Used internally, not part of the public API.
friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXm lNode& base); friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXm lNode& base);
#endif #endif
/** The types of XML nodes supported by TinyXml. (All the /** The types of XML nodes supported by TinyXml. (All the
unsupported types are picked up by UNKNOWN.) unsupported types are picked up by UNKNOWN.)
*/ */
enum NodeType enum NodeType
skipping to change at line 300 skipping to change at line 345
@verbatim @verbatim
Document: filename of the xml file Document: filename of the xml file
Element: name of the element Element: name of the element
Comment: the comment text Comment: the comment text
Unknown: the tag contents Unknown: the tag contents
Text: the text string Text: the text string
@endverbatim @endverbatim
The subclasses will wrap this function. The subclasses will wrap this function.
*/ */
const char * Value () const { return value.c_str (); } const char * Value() const { return value.c_str (); }
/** Changes the value of the node. Defined as: /** Changes the value of the node. Defined as:
@verbatim @verbatim
Document: filename of the xml file Document: filename of the xml file
Element: name of the element Element: name of the element
Comment: the comment text Comment: the comment text
Unknown: the tag contents Unknown: the tag contents
Text: the text string Text: the text string
@endverbatim @endverbatim
*/ */
void SetValue (const char * _value) { value = _value;} void SetValue(const char * _value) { value = _value;}
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
/// STL std::string form. /// STL std::string form.
void SetValue( const std::string& value ) void SetValue( const std::string& _value )
{ {
StringToBuffer buf( value ); StringToBuffer buf( _value );
SetValue( buf.buffer ? buf.buffer : "" ); SetValue( buf.buffer ? buf.buffer : "" );
} }
#endif #endif
/// Delete all the children of this node. Does not affect 'this'. /// Delete all the children of this node. Does not affect 'this'.
void Clear(); void Clear();
/// One step up the DOM. /// One step up the DOM.
TiXmlNode* Parent() const { re turn parent; } TiXmlNode* Parent() const { re turn parent; }
TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be nu ll if none found. TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be nu ll if none found.
TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* FirstChild( const std::string& value ) const { retu TiXmlNode* FirstChild( const std::string& _value ) const {
rn FirstChild (value.c_str ()); } ///< STL std::string form. return FirstChild (_value.c_str ()); } ///< STL std::string fo
TiXmlNode* LastChild( const std::string& value ) const { retu rm.
rn LastChild (value.c_str ()); } ///< STL std::string form. TiXmlNode* LastChild( const std::string& _value ) const {
return LastChild (_value.c_str ()); } ///< STL std::string fo
rm.
#endif #endif
/** An alternate way to walk the children of a node. /** An alternate way to walk the children of a node.
One way to iterate over nodes is: One way to iterate over nodes is:
@verbatim @verbatim
for( child = parent->FirstChild(); child; child = ch ild->NextSibling() ) for( child = parent->FirstChild(); child; child = ch ild->NextSibling() )
@endverbatim @endverbatim
IterateChildren does the same thing with the syntax: IterateChildren does the same thing with the syntax:
@verbatim @verbatim
skipping to change at line 361 skipping to change at line 406
IterateChildren takes the previous child as input and finds IterateChildren takes the previous child as input and finds
the next one. If the previous child is null, it returns the the next one. If the previous child is null, it returns the
first. IterateChildren will return null when done. first. IterateChildren will return null when done.
*/ */
TiXmlNode* IterateChildren( TiXmlNode* previous ) const; TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
/// This flavor of IterateChildren searches for children with a part icular 'value' /// This flavor of IterateChildren searches for children with a part icular 'value'
TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous ) const; TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous ) const;
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* pre vious ) const { return IterateChildren (value.c_str (), previou s); } ///< STL std::string form. TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* pr evious ) const { return IterateChildren (_value.c_str (), previo us); } ///< STL std::string form.
#endif #endif
/** Add a new node related to this. Adds a child past the LastChild. /** 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 occu red. Returns a pointer to the new object or NULL if an error occu red.
*/ */
TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
/** Add a new node related to this. Adds a child past the LastChild. /** 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 NOTE: the node to be added is passed by pointer, and will be
skipping to change at line 405 skipping to change at line 450
/// Delete a child of this node. /// Delete a child of this node.
bool RemoveChild( TiXmlNode* removeThis ); bool RemoveChild( TiXmlNode* removeThis );
/// Navigate to a sibling node. /// Navigate to a sibling node.
TiXmlNode* PreviousSibling() const { return pre v; } TiXmlNode* PreviousSibling() const { return pre v; }
/// Navigate to a sibling node. /// Navigate to a sibling node.
TiXmlNode* PreviousSibling( const char * ) const; TiXmlNode* PreviousSibling( const char * ) const;
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* PreviousSibling( const std::string& value ) const { TiXmlNode* PreviousSibling( const std::string& _value ) const {
return PreviousSibling (value.c_str ()); } ///< STL std::s return PreviousSibling (_value.c_str ()); } ///< STL std::s
tring form. tring form.
TiXmlNode* NextSibling( const std::string& value) const { retu TiXmlNode* NextSibling( const std::string& _value) const
rn NextSibling (value.c_str ()); } ///< STL std::string form. { return NextSibling (_value.c_str ()); } ///< STL std::s
tring form.
#endif #endif
/// Navigate to a sibling node. /// Navigate to a sibling node.
TiXmlNode* NextSibling() const { return nex t; } TiXmlNode* NextSibling() const { return nex t; }
/// Navigate to a sibling node with the given 'value'. /// Navigate to a sibling node with the given 'value'.
TiXmlNode* NextSibling( const char * ) const; TiXmlNode* NextSibling( const char * ) const;
/** Convenience function to get through elements. /** Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element Calls NextSibling and ToElement. Will skip all non-Element
skipping to change at line 428 skipping to change at line 473
*/ */
TiXmlElement* NextSiblingElement() const; TiXmlElement* NextSiblingElement() const;
/** Convenience function to get through elements. /** Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element Calls NextSibling and ToElement. Will skip all non-Element
nodes. Returns 0 if there is not another element. nodes. Returns 0 if there is not another element.
*/ */
TiXmlElement* NextSiblingElement( const char * ) const; TiXmlElement* NextSiblingElement( const char * ) const;
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlElement* NextSiblingElement( const std::string& value) const { return NextSiblingElement (value.c_str ()); } ///< ST L std::string form. TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< ST L std::string form.
#endif #endif
/// Convenience function to get through elements. /// Convenience function to get through elements.
TiXmlElement* FirstChildElement() const; TiXmlElement* FirstChildElement() const;
/// Convenience function to get through elements. /// Convenience function to get through elements.
TiXmlElement* FirstChildElement( const char * value ) const; TiXmlElement* FirstChildElement( const char * value ) const;
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlElement* FirstChildElement( const std::string& value ) const { return FirstChildElement (value.c_str ()); } ///< ST L std::string form. TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< ST L std::string form.
#endif #endif
/// Query the type (as an enumerated value, above) of this node. /** Query the type (as an enumerated value, above) of this node.
The possible types are: DOCUMENT, ELEMENT, COMMENT,
UNKNOWN, TEX
T, and DECLARATION.
*/
virtual int Type() const { return type; } virtual int Type() const { return type; }
/** Return a pointer to the Document this node lives in. /** Return a pointer to the Document this node lives in.
Returns null if not in a document. Returns null if not in a document.
*/ */
TiXmlDocument* GetDocument() const; TiXmlDocument* GetDocument() const;
/// Returns true if this node has no children. /// Returns true if this node has no children.
bool NoChildren() const { re turn !firstChild; } bool NoChildren() const { re turn !firstChild; }
skipping to change at line 499 skipping to change at line 547
TiXmlNode* next; TiXmlNode* next;
void* userData; void* userData;
}; };
/** An attribute is a name-value pair. Elements have an arbitrary /** An attribute is a name-value pair. Elements have an arbitrary
number of attributes, each with a unique name. number of attributes, each with a unique name.
@note The attributes are not TiXmlNodes, since they are not @note The attributes are not TiXmlNodes, since they are not
part of the tinyXML document object model. There are other part of the tinyXML document object model. There are other
suggested ways to look at this problem. suggested ways to look at this problem.
@note Attributes have a parent
*/ */
class TiXmlAttribute : public TiXmlBase class TiXmlAttribute : public TiXmlBase
{ {
friend class TiXmlAttributeSet; friend class TiXmlAttributeSet;
public: public:
/// Construct an empty attribute. /// Construct an empty attribute.
TiXmlAttribute() : prev( 0 ), next( 0 ) {} TiXmlAttribute()
{
document = 0;
prev = next = 0;
}
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
/// std::string constructor. /// std::string constructor.
TiXmlAttribute( const std::string& _name, const std::string& _value ) TiXmlAttribute( const std::string& _name, const std::string& _value )
{ {
name = _name; name = _name;
value = _value; value = _value;
document = 0;
prev = next = 0;
} }
#endif #endif
/// Construct an attribute with a name and value. /// Construct an attribute with a name and value.
TiXmlAttribute( const char * _name, const char * _value ): name( _na TiXmlAttribute( const char * _name, const char * _value )
me ), value( _value ), prev( 0 ), next( 0 ) {} {
name = _name;
value = _value;
document = 0;
prev = next = 0;
}
const char* Name() const { return name.c_str (); } ///< Return the name of this attribute. const char* Name() const { return name.c_str (); } ///< Return the name of this attribute.
const char* Value() const { return value.c_str (); } ///< Return the value of this attribute. const char* Value() const { return value.c_str (); } ///< Return the value of this attribute.
const int IntValue() const; ///< Return the value of this attribute , converted to an integer. const int IntValue() const; ///< Return the value of this attribute , converted to an integer.
const double DoubleValue() const; ///< Return the value of this attribute, conver ted to a double. const double DoubleValue() const; ///< Return the value of this attribute, conver ted to a double.
/** QueryIntValue examines the value string. It is an alternative to
the
IntValue() method with richer error checking.
If the value 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.
A specialized but useful call. Note that for success it retu
rns 0,
which is the opposite of almost all other TinyXml calls.
*/
int QueryIntValue( int* value ) const;
/// QueryDoubleValue examines the value string. See QueryIntValue().
int QueryDoubleValue( double* value ) const;
void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute.
void SetValue( const char* _value ) { value = _value; } ///< Set the value. void SetValue( const char* _value ) { value = _value; } ///< Set the value.
void SetIntValue( int value ); ///< Set the value from an integer. void SetIntValue( int value ); ///< Set the value from an integer.
void SetDoubleValue( double value ); ///< Set the value from a double. void SetDoubleValue( double value ); ///< Set the value from a double.
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
/// STL std::string form. /// STL std::string form.
void SetName( const std::string& _name ) void SetName( const std::string& _name )
{ {
skipping to change at line 560 skipping to change at line 632
TiXmlAttribute* Previous() const; TiXmlAttribute* Previous() const;
bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
bool operator>( const TiXmlAttribute& rhs ) const { return name > r hs.name; } bool operator>( const TiXmlAttribute& rhs ) const { return name > r hs.name; }
/* [internal use] /* [internal use]
Attribtue parsing starts: first letter of the name Attribtue parsing starts: first letter of the name
returns: the next char afte r the value end quote returns: the next char afte r the value end quote
*/ */
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da ta );
// [internal use] // [internal use]
virtual void Print( FILE* cfile, int depth ) const; virtual void Print( FILE* cfile, int depth ) const;
virtual void StreamOut( TIXML_OSTREAM * out ) const; virtual void StreamOut( TIXML_OSTREAM * out ) const;
// [internal use] // [internal use]
// Set the document pointer so the attribute can report errors. // Set the document pointer so the attribute can report errors.
void SetDocument( TiXmlDocument* doc ) { document = doc; } void SetDocument( TiXmlDocument* doc ) { document = doc; }
private: private:
skipping to change at line 628 skipping to change at line 700
/// std::string constructor. /// std::string constructor.
TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode ::ELEMENT ) TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode ::ELEMENT )
{ {
firstChild = lastChild = 0; firstChild = lastChild = 0;
value = _value; value = _value;
} }
#endif #endif
virtual ~TiXmlElement(); virtual ~TiXmlElement();
/** Given an attribute name, attribute returns the value /** Given an attribute name, Attribute() returns the value
for the attribute of that name, or null if none exists. for the attribute of that name, or null if none exists.
*/ */
const char* Attribute( const char* name ) const; const char* Attribute( const char* name ) const;
/** Given an attribute name, attribute returns the value /** Given an attribute name, Attribute() returns the value
for the attribute of that name, or null if none exists. for the attribute of that name, or null if none exists.
If the attribute exists and can be converted to an integer, If the attribute exists and can be converted to an integer,
the integer value will be put in the return 'i', if 'i' the integer value will be put in the return 'i', if 'i'
is non-null. is non-null.
*/ */
const char* Attribute( const char* name, int* i ) const; 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 double,
the double value will be put in the return 'd', if 'd'
is non-null.
*/
const char* Attribute( const char* name, double* d ) 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.
*/
int QueryIntAttribute( const char* name, int* value ) const;
/// QueryDoubleAttribute examines the attribute - see QueryIntAttrib
ute().
int QueryDoubleAttribute( const char* name, double* value ) const;
/** Sets an attribute of name to a given value. The attribute /** Sets an attribute of name to a given value. The attribute
will be created if it does not exist, or changed if it does. will be created if it does not exist, or changed if it does.
*/ */
void SetAttribute( const char* name, const char * value ); void SetAttribute( const char* name, const char * value );
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); } const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); } const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
/// STL std::string form. /// STL std::string form.
void SetAttribute( const std::string& name, const std::string& value ) void SetAttribute( const std::string& name, const std::string& _valu e )
{ {
StringToBuffer n( name ); StringToBuffer n( name );
StringToBuffer v( value ); StringToBuffer v( _value );
if ( n.buffer && v.buffer ) if ( n.buffer && v.buffer )
SetAttribute (n.buffer, v.buffer ); SetAttribute (n.buffer, v.buffer );
} }
///< STL std::string form. ///< STL std::string form.
void SetAttribute( const std::string& name, int value ) void SetAttribute( const std::string& name, int _value )
{ {
StringToBuffer n( name ); StringToBuffer n( name );
if ( n.buffer ) if ( n.buffer )
SetAttribute (n.buffer, value); SetAttribute (n.buffer, _value);
} }
#endif #endif
/** Sets an attribute of name to a given value. The attribute /** Sets an attribute of name to a given value. The attribute
will be created if it does not exist, or changed if it does. will be created if it does not exist, or changed if it does.
*/ */
void SetAttribute( const char * name, int value ); void SetAttribute( const char * name, int value );
/** Deletes an attribute with the given name. /** Deletes an attribute with the given name.
*/ */
skipping to change at line 700 skipping to change at line 791
// Used to be public [internal use] // Used to be public [internal use]
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
virtual void StreamOut( TIXML_OSTREAM * out ) const; virtual void StreamOut( TIXML_OSTREAM * out ) const;
/* [internal use] /* [internal use]
Attribtue parsing starts: next char past '<' Attribtue parsing starts: next char past '<'
returns: next char past '>' returns: next char past '>'
*/ */
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da ta );
/* [internal use] /* [internal use]
Reads the "value" of the element -- another element, or text . Reads the "value" of the element -- another element, or text .
This should terminate with the current end tag. This should terminate with the current end tag.
*/ */
const char* ReadValue( const char* in ); const char* ReadValue( const char* in, const TiXmlParsingData* prevD ata );
private: private:
TiXmlAttributeSet attributeSet; TiXmlAttributeSet attributeSet;
}; };
/** An XML comment. /** An XML comment.
*/ */
class TiXmlComment : public TiXmlNode class TiXmlComment : public TiXmlNode
{ {
public: public:
skipping to change at line 735 skipping to change at line 826
protected: protected:
// used to be public // used to be public
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
virtual void StreamOut( TIXML_OSTREAM * out ) const; virtual void StreamOut( TIXML_OSTREAM * out ) const;
/* [internal use] /* [internal use]
Attribtue parsing starts: at the ! of the !-- Attribtue parsing starts: at the ! of the !--
returns: next char past '>' returns: next char past '>'
*/ */
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da ta );
}; };
/** XML text. Contained in an element. /** XML text. Contained in an element.
*/ */
class TiXmlText : public TiXmlNode class TiXmlText : public TiXmlNode
{ {
friend class TiXmlElement; friend class TiXmlElement;
public: public:
/// Constructor. /// Constructor.
TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT) TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
skipping to change at line 771 skipping to change at line 862
protected : protected :
// [internal use] Creates a new Element and returns it. // [internal use] Creates a new Element and returns it.
virtual TiXmlNode* Clone() const; virtual TiXmlNode* Clone() const;
virtual void StreamOut ( TIXML_OSTREAM * out ) const; virtual void StreamOut ( TIXML_OSTREAM * out ) const;
// [internal use] // [internal use]
bool Blank() const; // returns true if all white space and new l ines bool Blank() const; // returns true if all white space and new l ines
/* [internal use] /* [internal use]
Attribtue parsing starts: First char of the text Attribtue parsing starts: First char of the text
returns: next char past '>' returns: next char past '>'
*/ */
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da
ta );
// [internal use] // [internal use]
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
}; };
/** In correct XML the declaration is the first entry in the file. /** In correct XML the declaration is the first entry in the file.
@verbatim @verbatim
<?xml version="1.0" standalone="yes"?> <?xml version="1.0" standalone="yes"?>
@endverbatim @endverbatim
skipping to change at line 800 skipping to change at line 891
because there can only be at most 3 and they are always the same. because there can only be at most 3 and they are always the same.
*/ */
class TiXmlDeclaration : public TiXmlNode class TiXmlDeclaration : public TiXmlNode
{ {
public: public:
/// Construct an empty declaration. /// Construct an empty declaration.
TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {} TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
/// Constructor. /// Constructor.
TiXmlDeclaration( TiXmlDeclaration( const std::string& _version,
const std::string& _version,
const std::string& _encoding , const std::string& _encoding ,
const std::string& _standalo ne ) const std::string& _standalo ne )
: TiXmlNode( TiXmlNode::DECLARATION ) : TiXmlNode( TiXmlNode::DECLARATION )
{ {
version = _version; version = _version;
encoding = _encoding; encoding = _encoding;
standalone = _standalone; standalone = _standalone;
} }
#endif #endif
/// Construct. /// Construct.
TiXmlDeclaration::TiXmlDeclaration( const char * _version, TiXmlDeclaration( const char* _version,
const char* _encoding,
const char * _encoding, const char* _standalone );
const char * _standalone );
virtual ~TiXmlDeclaration() {} virtual ~TiXmlDeclaration() {}
/// Version. Will return empty if none was found. /// Version. Will return empty if none was found.
const char * Version() const { return version.c_str (); } const char * Version() const { return version.c_str (); }
/// Encoding. Will return empty if none was found. /// Encoding. Will return empty if none was found.
const char * Encoding() const { return encoding.c_str (); } const char * Encoding() const { return encoding.c_str (); }
/// Is this a standalone document? /// Is this a standalone document?
const char * Standalone() const { return standalone.c_str () ; } const char * Standalone() const { return standalone.c_str () ; }
skipping to change at line 841 skipping to change at line 931
protected: protected:
// used to be public // used to be public
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
virtual void StreamOut ( TIXML_OSTREAM * out) const; virtual void StreamOut ( TIXML_OSTREAM * out) const;
// [internal use] // [internal use]
// Attribtue parsing starts: next char past '<' // Attribtue parsing starts: next char past '<'
// returns: next char past '>' // returns: next char past '>'
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da ta );
private: private:
TIXML_STRING version; TIXML_STRING version;
TIXML_STRING encoding; TIXML_STRING encoding;
TIXML_STRING standalone; TIXML_STRING standalone;
}; };
/** Any tag that tinyXml doesn't recognize is save as an /** Any tag that tinyXml doesn't recognize is saved as an
unknown. It is a tag of text, but should not be modified. unknown. It is a tag of text, but should not be modified.
It will be written back to the XML, unchanged, when the file It will be written back to the XML, unchanged, when the file
is saved. is saved.
*/ */
class TiXmlUnknown : public TiXmlNode class TiXmlUnknown : public TiXmlNode
{ {
public: public:
TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {} TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
virtual ~TiXmlUnknown() {} virtual ~TiXmlUnknown() {}
// [internal use] // [internal use]
virtual TiXmlNode* Clone() const; virtual TiXmlNode* Clone() const;
// [internal use] // [internal use]
virtual void Print( FILE* cfile, int depth ) const; virtual void Print( FILE* cfile, int depth ) const;
protected: protected:
// used to be public
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
virtual void StreamOut ( TIXML_OSTREAM * out ) const; virtual void StreamOut ( TIXML_OSTREAM * out ) const;
/* [internal use] /* [internal use]
Attribute parsing starts: First char of the text Attribute parsing starts: First char of the text
returns: next char past '>' returns: next char past '>'
*/ */
virtual const char* Parse( const char* p ); virtual const char* Parse( const char* p, const TiXmlParsingData* da ta );
}; };
/** Always the top level node. A document binds together all the /** Always the top level node. A document binds together all the
XML pieces. It can be saved, loaded, and printed to the screen. XML pieces. It can be saved, loaded, and printed to the screen.
The 'value' of a document node is the xml file name. The 'value' of a document node is the xml file name.
*/ */
class TiXmlDocument : public TiXmlNode class TiXmlDocument : public TiXmlNode
{ {
public: public:
/// Create an empty document, that has no name. /// Create an empty document, that has no name.
skipping to change at line 926 skipping to change at line 1015
StringToBuffer f( filename ); StringToBuffer f( filename );
return ( f.buffer && LoadFile( f.buffer )); return ( f.buffer && LoadFile( f.buffer ));
} }
bool SaveFile( const std::string& filename ) const ///< STL std::string version. bool SaveFile( const std::string& filename ) const ///< STL std::string version.
{ {
StringToBuffer f( filename ); StringToBuffer f( filename );
return ( f.buffer && SaveFile( f.buffer )); return ( f.buffer && SaveFile( f.buffer ));
} }
#endif #endif
/// Parse the given null terminated block of xml data. /** Parse the given null terminated block of xml data.
virtual const char* Parse( const char* p ); */
virtual const char* Parse( const char* p, const TiXmlParsingData* da
ta = 0 );
/** Get the root element -- the only top level element -- of the doc ument. /** Get the root element -- the only top level element -- of the doc ument.
In well formed XML, there should only be one. TinyXml is tol erant of In well formed XML, there should only be one. TinyXml is tol erant of
multiple elements at the document level. multiple elements at the document level.
*/ */
TiXmlElement* RootElement() const { return FirstChildE lement(); } TiXmlElement* RootElement() const { return FirstChildE lement(); }
/// If, during parsing, a error occurs, Error will be set to true. /** If an error occurs, Error will be set to true. Also,
- The ErrorId() will contain the integer identifier of the e
rror (not generally useful)
- The ErrorDesc() method will return the name of the error.
(very useful)
- The ErrorRow() and ErrorCol() will return the location of
the error (if known)
*/
bool Error() const { re turn error; } bool Error() const { re turn error; }
/// Contains a textual (english) description of the error if one occ urs. /// Contains a textual (english) description of the error if one occ urs.
const char * ErrorDesc() const { return errorDesc.c_str (); } const char * ErrorDesc() const { return errorDesc.c_str (); }
/** Generally, you probably want the error string ( ErrorDesc() ). B ut if you /** Generally, you probably want the error string ( ErrorDesc() ). B ut if you
prefer the ErrorId, this function will fetch it. prefer the ErrorId, this function will fetch it.
*/ */
const int ErrorId() const { return err orId; } const int ErrorId() const { return err orId; }
/// If you have handled the error, it can be reset with this call. /** Returns the location (if known) of the error. The first column i
void ClearError() { er s column 1,
ror = false; errorId = 0; errorDesc = ""; } and the first row is row 1. A value of 0 means the row and c
olumn wasn't applicable
(memory errors, for example, have no row/column) or the pars
er lost the error. (An
error in the error reporting, in that case.)
@sa SetTabSize, Row, Column
*/
int ErrorRow() { return errorLocation.row+1; }
int ErrorCol() { return errorLocation.col+1; } ///< The column wher
e the error occured. See ErrorRow()
/** By calling this method, with a tab size
greater than 0, the row and column of each node and attribut
e is stored
when the file is loaded. Very useful for tracking the DOM ba
ck in to
the source file.
The tab size is required for calculating the location of nod
es. If not
set, the default of 4 is used. The tabsize is set per docume
nt. Setting
the tabsize to 0 disables row/column tracking (which has a m
inor performance
cost.)
Note that row and column tracking is not supported when usin
g operator>>.
The tab size needs to be enabled before the parse or load. C
orrect usage:
@verbatim
TiXmlDocument doc;
doc.SetTabSize( 8 );
doc.Load( "myfile.xml" );
@endverbatim
@sa Row, Column
*/
void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
int TabSize() const { return tabsize; }
/** If you have handled the error, it can be reset with this call. T
he error
state is automatically cleared if you Parse a new XML block.
*/
void ClearError() {
error = false;
errorId = 0;
errorDesc = "";
errorLocation.row = errorLocation.col = 0;
//errorLocation.last = 0;
}
/** Dump the document to standard out. */ /** Dump the document to standard out. */
void Print() const { Pr int( stdout, 0 ); } void Print() const { Pr int( stdout, 0 ); }
// [internal use] // [internal use]
virtual void Print( FILE* cfile, int depth = 0 ) const; virtual void Print( FILE* cfile, int depth = 0 ) const;
// [internal use] // [internal use]
void SetError( int err ) { assert( err > 0 && err < TIX void SetError( int err, const char* errorLocation, const TiXmlParsin
ML_ERROR_STRING_COUNT ); gData* prevData );
error = true;
errorId = err;
errorDesc = errorString[ errorId ]; }
protected : protected :
virtual void StreamOut ( TIXML_OSTREAM * out) const; virtual void StreamOut ( TIXML_OSTREAM * out) const;
// [internal use] // [internal use]
virtual TiXmlNode* Clone() const; virtual TiXmlNode* Clone() const;
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
#endif #endif
private: private:
bool error; bool error;
int errorId; int errorId;
TIXML_STRING errorDesc; TIXML_STRING errorDesc;
int tabsize;
TiXmlCursor errorLocation;
};
/**
A TiXmlHandle is a class that wraps a node pointer with null checks;
this is
an incredibly useful thing. Note that TiXmlHandle is not part of the
TinyXml
DOM structure. It is a separate utility class.
Take an example:
@verbatim
<Document>
<Element attributeA = "valueA">
<Child attributeB = "value1" />
<Child attributeB = "value2" />
</Element>
<Document>
@endverbatim
Assuming you want the value of "attributeB" in the 2nd "Child" eleme
nt, it's very
easy to write a *lot* of code that looks like:
@verbatim
TiXmlElement* root = document.FirstChildElement( "Document" );
if ( root )
{
TiXmlElement* element = root->FirstChildElement( "Element" )
;
if ( element )
{
TiXmlElement* child = element->FirstChildElement( "C
hild" );
if ( child )
{
TiXmlElement* child2 = child->NextSiblingEle
ment( "Child" );
if ( child2 )
{
// Finally do something useful.
@endverbatim
And that doesn't even cover "else" cases. TiXmlHandle addresses the
verbosity
of such code. A TiXmlHandle checks for null pointers so it is pe
rfectly safe
and correct to use:
@verbatim
TiXmlHandle docHandle( &document );
TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild
( "Element" ).Child( "Child", 1 ).Element();
if ( child2 )
{
// do something useful
@endverbatim
Which is MUCH more concise and useful.
It is also safe to copy handles - internally they are nothing more t
han node pointers.
@verbatim
TiXmlHandle handleCopy = handle;
@endverbatim
What they should not be used for is iteration:
@verbatim
int i=0;
while ( true )
{
TiXmlElement* child = docHandle.FirstChild( "Document" ).Fir
stChild( "Element" ).Child( "Child", i ).Element();
if ( !child )
break;
// do something
++i;
}
@endverbatim
It seems reasonable, but it is in fact two embedded while loops. The
Child method is
a linear walk to find the element, so this code would iterate much m
ore than it needs
to. Instead, prefer:
@verbatim
TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild(
"Element" ).FirstChild( "Child" ).Element();
for( child; child; child=child->NextSiblingElement() )
{
// do something
}
@endverbatim
*/
class TiXmlHandle
{
public:
/// Create a handle from any node (at any depth of the tree.) This c
an be a null pointer.
TiXmlHandle( TiXmlNode* node ) { this->node = node;
}
/// Copy constructor
TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
/// Return a handle to the first child node.
TiXmlHandle FirstChild() const;
/// Return a handle to the first child node with the given name.
TiXmlHandle FirstChild( const char * value ) const;
/// Return a handle to the first child element.
TiXmlHandle FirstChildElement() const;
/// Return a handle to the first child element with the given name.
TiXmlHandle FirstChildElement( const char * value ) const;
/** Return a handle to the "index" child with the given name.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( const char* value, int index ) const;
/** Return a handle to the "index" child.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( int index ) const;
/** Return a handle to the "index" child element with the given name
.
The first child element is 0, the second 1, etc. Note that o
nly TiXmlElements
are indexed: other types are not counted.
*/
TiXmlHandle ChildElement( const char* value, int index ) const;
/** Return a handle to the "index" child element.
The first child element is 0, the second 1, etc. Note that o
nly TiXmlElements
are indexed: other types are not counted.
*/
TiXmlHandle ChildElement( int index ) const;
#ifdef TIXML_USE_STL
TiXmlHandle FirstChild( const std::string& _value ) const
{ return FirstChild( _value.c_str() ); }
TiXmlHandle FirstChildElement( const std::string& _value ) const
{ return FirstChildElement( _value.c_str() ); }
TiXmlHandle Child( const std::string& _value, int index ) const
{ return Child( _value.c_str(), index ); }
TiXmlHandle ChildElement( const std::string& _value, int index ) con
st { return ChildElement( _value.c_str(), index ); }
#endif
/// Return the handle as a TiXmlNode. This may return null.
TiXmlNode* Node() const { return node; }
/// Return the handle as a TiXmlElement. This may return null.
TiXmlElement* Element() const { return ( ( node && node->ToElement
() ) ? node->ToElement() : 0 ); }
/// Return the handle as a TiXmlText. This may return null.
TiXmlText* Text() const { return ( ( node && node->T
oText() ) ? node->ToText() : 0 ); }
private:
TiXmlNode* node;
}; };
#endif #endif
 End of changes. 54 change blocks. 
77 lines changed or deleted 411 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/