26 #ifndef TINYXML_INCLUDED
27 #define TINYXML_INCLUDED
30 #pragma warning( push )
31 #pragma warning( disable : 4530 )
32 #pragma warning( disable : 4786 )
42 #if defined( _DEBUG ) && !defined( DEBUG )
50 #define TIXML_STRING std::string
53 #define TIXML_STRING TiXmlString
63 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
65 #define TIXML_SNPRINTF _snprintf_s
66 #define TIXML_SSCANF sscanf_s
67 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
70 #define TIXML_SNPRINTF _snprintf
71 #define TIXML_SSCANF sscanf
72 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
75 #define TIXML_SNPRINTF snprintf
76 #define TIXML_SSCANF sscanf
78 #define TIXML_SNPRINTF snprintf
79 #define TIXML_SSCANF sscanf
90 class TiXmlParsingData;
92 const int TIXML_MAJOR_VERSION = 2;
93 const int TIXML_MINOR_VERSION = 6;
94 const int TIXML_PATCH_VERSION = 1;
102 void Clear() { row = col = -1; }
165 TIXML_ENCODING_UNKNOWN,
167 TIXML_ENCODING_LEGACY
170 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
213 virtual void Print( FILE* cfile,
int depth )
const = 0;
244 int Row()
const {
return location.row + 1; }
245 int Column()
const {
return location.col + 1; }
253 static const int utf8ByteTable[256];
255 virtual const char*
Parse(
const char* p,
256 TiXmlParsingData* data,
257 TiXmlEncoding encoding ) = 0;
262 static void EncodeString(
const TIXML_STRING& str, TIXML_STRING* out );
268 TIXML_ERROR_OPENING_FILE,
269 TIXML_ERROR_PARSING_ELEMENT,
270 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
271 TIXML_ERROR_READING_ELEMENT_VALUE,
272 TIXML_ERROR_READING_ATTRIBUTES,
273 TIXML_ERROR_PARSING_EMPTY,
274 TIXML_ERROR_READING_END_TAG,
275 TIXML_ERROR_PARSING_UNKNOWN,
276 TIXML_ERROR_PARSING_COMMENT,
277 TIXML_ERROR_PARSING_DECLARATION,
278 TIXML_ERROR_DOCUMENT_EMPTY,
279 TIXML_ERROR_EMBEDDED_NULL,
280 TIXML_ERROR_PARSING_CDATA,
281 TIXML_ERROR_DOCUMENT_TOP_ONLY,
283 TIXML_ERROR_STRING_COUNT
288 static const char* SkipWhiteSpace(
const char*, TiXmlEncoding encoding );
290 inline static bool IsWhiteSpace(
char c )
292 return ( isspace( (
unsigned char) c ) || c ==
'\n' || c ==
'\r' );
294 inline static bool IsWhiteSpace(
int c )
297 return IsWhiteSpace( (
char) c );
302 static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
303 static bool StreamTo( std::istream * in,
int character, TIXML_STRING * tag );
310 static const char* ReadName(
const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
315 static const char* ReadText(
const char* in,
317 bool ignoreWhiteSpace,
320 TiXmlEncoding encoding );
323 static const char* GetEntity(
const char* in,
char* value,
int* length, TiXmlEncoding encoding );
327 inline static const char* GetChar(
const char* p,
char* _value,
int* length, TiXmlEncoding encoding )
330 if ( encoding == TIXML_ENCODING_UTF8 )
332 *length = utf8ByteTable[ *((
const unsigned char*)p) ];
333 assert( *length >= 0 && *length < 5 );
343 return GetEntity( p, _value, length, encoding );
351 for(
int i=0; p[i] && i<*length; ++i ) {
354 return p + (*length);
366 static bool StringEqual(
const char* p,
369 TiXmlEncoding encoding );
371 static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
380 static int IsAlpha(
unsigned char anyByte, TiXmlEncoding encoding );
381 static int IsAlphaNum(
unsigned char anyByte, TiXmlEncoding encoding );
382 inline static int ToLower(
int v, TiXmlEncoding encoding )
384 if ( encoding == TIXML_ENCODING_UTF8 )
386 if ( v < 128 )
return tolower( v );
394 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
403 unsigned int strLength;
409 MAX_ENTITY_LENGTH = 6
412 static Entity entity[ NUM_ENTITY ];
413 static bool condenseWhiteSpace;
434 friend std::istream& operator >> (std::istream& in,
TiXmlNode& base);
452 friend std::ostream& operator<< (std::ostream& out,
const TiXmlNode& base);
455 friend std::string& operator<< (std::string& out,
const TiXmlNode& base );
487 const char *
Value()
const {
return value.c_str (); }
494 const std::string& ValueStr()
const {
return value; }
497 const TIXML_STRING& ValueTStr()
const {
return value; }
508 void SetValue(
const char * _value) { value = _value;}
512 void SetValue(
const std::string& _value ) { value = _value; }
529 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->FirstChild( _value ));
531 const TiXmlNode* LastChild()
const {
return lastChild; }
534 const TiXmlNode* LastChild(
const char * value )
const;
536 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->LastChild( _value ));
542 const TiXmlNode* LastChild(
const std::string& _value )
const {
return LastChild (_value.c_str ()); }
543 TiXmlNode* LastChild(
const std::string& _value ) {
return LastChild (_value.c_str ()); }
564 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( previous ) );
570 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( _value, previous ) );
620 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->PreviousSibling( _prev ) );
637 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSibling( _next ) );
655 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSiblingElement( _next ) );
672 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->FirstChildElement( _value ) );
684 int Type()
const {
return type; }
749 virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
753 TiXmlNode* Identify(
const char* start, TiXmlEncoding encoding );
793 TiXmlAttribute(
const std::string& _name,
const std::string& _value )
811 const char*
Name()
const {
return name.c_str(); }
812 const char*
Value()
const {
return value.c_str(); }
814 const std::string& ValueStr()
const {
return value; }
820 const TIXML_STRING& NameTStr()
const {
return name; }
835 void SetName(
const char* _name ) { name = _name; }
836 void SetValue(
const char* _value ) { value = _value; }
843 void SetName(
const std::string& _name ) { name = _name; }
845 void SetValue(
const std::string& _value ) { value = _value; }
860 bool operator==(
const TiXmlAttribute& rhs )
const {
return rhs.name == name; }
861 bool operator<(
const TiXmlAttribute& rhs )
const {
return name < rhs.name; }
862 bool operator>(
const TiXmlAttribute& rhs )
const {
return name > rhs.name; }
867 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
870 virtual void Print( FILE* cfile,
int depth )
const {
871 Print( cfile, depth, 0 );
873 void Print( FILE* cfile,
int depth, TIXML_STRING* str )
const;
912 const TiXmlAttribute* First()
const {
return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
913 TiXmlAttribute* First() {
return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
914 const TiXmlAttribute* Last()
const {
return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
915 TiXmlAttribute* Last() {
return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
920 # ifdef TIXML_USE_STL
960 const char*
Attribute(
const char* name )
const;
968 const char*
Attribute(
const char* name,
int* i )
const;
976 const char*
Attribute(
const char* name,
double* d )
const;
992 if ( result == TIXML_SUCCESS ) {
1000 int QueryStringAttribute(
const char* name, std::string* _value )
const {
1003 *_value = std::string( cstr );
1004 return TIXML_SUCCESS;
1006 return TIXML_NO_ATTRIBUTE;
1017 template<
typename T >
int QueryValueAttribute(
const std::string& name, T* outValue )
const
1021 return TIXML_NO_ATTRIBUTE;
1023 std::stringstream sstream( node->ValueStr() );
1024 sstream >> *outValue;
1025 if ( !sstream.fail() )
1026 return TIXML_SUCCESS;
1027 return TIXML_WRONG_TYPE;
1030 int QueryValueAttribute(
const std::string& name, std::string* outValue )
const
1034 return TIXML_NO_ATTRIBUTE;
1035 *outValue = node->ValueStr();
1036 return TIXML_SUCCESS;
1043 void SetAttribute(
const char* name,
const char * _value );
1045 #ifdef TIXML_USE_STL
1046 const std::string*
Attribute(
const std::string& name )
const;
1047 const std::string*
Attribute(
const std::string& name,
int* i )
const;
1048 const std::string*
Attribute(
const std::string& name,
double* d )
const;
1053 void SetAttribute(
const std::string& name,
const std::string& _value );
1055 void SetAttribute(
const std::string& name,
int _value );
1073 #ifdef TIXML_USE_STL
1119 virtual void Print( FILE* cfile,
int depth )
const;
1124 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1139 #ifdef TIXML_USE_STL
1140 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1146 const char* ReadValue(
const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1172 virtual void Print( FILE* cfile,
int depth )
const;
1177 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1190 #ifdef TIXML_USE_STL
1191 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1220 #ifdef TIXML_USE_STL
1230 void operator=(
const TiXmlText& base ) { base.CopyTo(
this ); }
1233 virtual void Print( FILE* cfile,
int depth )
const;
1240 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1256 #ifdef TIXML_USE_STL
1257 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1284 #ifdef TIXML_USE_STL
1287 const std::string& _encoding,
1288 const std::string& _standalone );
1293 const char* _encoding,
1294 const char* _standalone );
1302 const char *
Version()
const {
return version.c_str (); }
1304 const char *
Encoding()
const {
return encoding.c_str (); }
1311 virtual void Print( FILE* cfile,
int depth, TIXML_STRING* str )
const;
1312 virtual void Print( FILE* cfile,
int depth )
const {
1313 Print( cfile, depth, 0 );
1316 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1328 #ifdef TIXML_USE_STL
1329 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1334 TIXML_STRING version;
1335 TIXML_STRING encoding;
1336 TIXML_STRING standalone;
1354 void operator=(
const TiXmlUnknown& copy ) { copy.CopyTo(
this ); }
1359 virtual void Print( FILE* cfile,
int depth )
const;
1361 virtual const char* Parse(
const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1373 #ifdef TIXML_USE_STL
1374 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1394 #ifdef TIXML_USE_STL
1408 bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1412 bool LoadFile(
const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1414 bool SaveFile(
const char * filename )
const;
1420 bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1424 #ifdef TIXML_USE_STL
1425 bool LoadFile(
const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1427 return LoadFile( filename.c_str(), encoding );
1429 bool SaveFile(
const std::string& filename )
const
1431 return SaveFile( filename.c_str() );
1439 virtual const char*
Parse(
const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1456 const char *
ErrorDesc()
const {
return errorDesc.c_str (); }
1499 int TabSize()
const {
return tabsize; }
1507 errorLocation.row = errorLocation.col = 0;
1521 virtual void Print( FILE* cfile,
int depth = 0 )
const;
1523 void SetError(
int err,
const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1535 #ifdef TIXML_USE_STL
1536 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1544 TIXML_STRING errorDesc;
1547 bool useMicrosoftBOM;
1668 #ifdef TIXML_USE_STL
1672 TiXmlHandle Child(
const std::string& _value,
int index )
const {
return Child( _value.c_str(), index ); }
1734 buffer(), indent(
" " ), lineBreak(
"\n" ) {}
1750 void SetIndent(
const char* _indent ) { indent = _indent ? _indent :
"" ; }
1752 const char*
Indent() {
return indent.c_str(); }
1757 void SetLineBreak(
const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak :
""; }
1768 const char*
CStr() {
return buffer.c_str(); }
1770 size_t Size() {
return buffer.size(); }
1772 #ifdef TIXML_USE_STL
1774 const std::string& Str() {
return buffer; }
1779 for(
int i=0; i<depth; ++i )
1782 void DoLineBreak() {
1783 buffer += lineBreak;
1787 bool simpleTextPrint;
1788 TIXML_STRING buffer;
1789 TIXML_STRING indent;
1790 TIXML_STRING lineBreak;
1795 #pragma warning( pop )
An attribute is a name-value pair.
const char * Name() const
Return the name of this attribute.
void SetDoubleValue(double _value)
Set the value from a double.
void SetValue(const char *_value)
Set the value.
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 ...
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
void SetIntValue(int _value)
Set the value from an integer.
double DoubleValue() const
Return the value of this attribute, converted to a double.
TiXmlAttribute()
Construct an empty attribute.
void SetName(const char *_name)
Set the name of this attribute.
int IntValue() const
Return the value of this attribute, converted to an integer.
const char * Value() const
Return the value of this attribute.
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
TiXmlBase is a base class for every class in TinyXml.
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
static void EncodeString(const TiXmlString &str, TiXmlString *out)
Expands entities in a string.
void * GetUserData()
Get a pointer to arbitrary user data.
const void * GetUserData() const
Get a pointer to arbitrary user data.
void SetUserData(void *user)
Set a pointer to arbitrary user data.
int Row() const
Return the position, in the original source file, of this node or attribute.
int Column() const
See Row()
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
In correct XML the declaration is the first entry in the file.
const char * Standalone() const
Is this a standalone document?
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
const char * Encoding() const
Encoding. Will return an empty string if none was found.
const char * Version() const
Version. Will return an empty string if none was found.
TiXmlDeclaration()
Construct an empty declaration.
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
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 ...
Always the top level node.
int ErrorRow() const
Returns the location (if known) of the error.
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
bool Error() const
If an error occurs, Error will be set to true.
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
void SetTabSize(int _tabsize)
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct v...
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
TiXmlDocument()
Create an empty document, that has no name.
void Print() const
Write the document to standard out using formatted printing ("pretty print").
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
void ClearError()
If you have handled the error, it can be reset with this call.
int ErrorCol() const
The column where the error occured. See ErrorRow()
The element is a container class.
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
int QueryIntAttribute(const char *name, int *_value) const
QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer...
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name,...
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
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 ...
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
const char * GetText() const
Convenience function for easy access to the text inside an element.
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
TiXmlElement * ToElement() const
Return the handle as a TiXmlElement.
TiXmlNode * ToNode() const
Return the handle as a TiXmlNode.
TiXmlUnknown * Unknown() const
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
TiXmlUnknown * ToUnknown() const
Return the handle as a TiXmlUnknown.
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
TiXmlText * ToText() const
Return the handle as a TiXmlText.
TiXmlElement * Element() const
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
TiXmlHandle FirstChild() const
Return a handle to the first child node.
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
The parent class for everything in the Document Object Model.
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
int Type() const
Query the type (as an enumerated value, above) of this node.
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
void SetValue(const char *_value)
Changes the value of the node.
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
void Clear()
Delete all the children of this node. Does not affect 'this'.
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
NodeType
The types of XML nodes supported by TinyXml.
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlNode * Parent()
One step up the DOM.
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
TiXmlNode * FirstChild(const char *_value)
The first child of this node with the matching 'value'. Will be null if none found.
bool NoChildren() const
Returns true if this node has no children.
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
virtual bool Accept(TiXmlVisitor *visitor) const =0
Accept a hierchical visit the nodes in the TinyXML DOM.
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Print to memory functionality.
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
const char * LineBreak()
Query the current line breaking string.
void SetIndent(const char *_indent)
Set the indent characters for printing.
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
void SetLineBreak(const char *_lineBreak)
Set the line breaking string.
const char * CStr()
Return the result.
void SetStreamPrinting()
Switch over to "stream printing" which is the most dense formatting without linebreaks.
const char * Indent()
Query the indention string.
size_t Size()
Return the length of the result string.
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
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 ...
bool CDATA() const
Queries whether this represents text using a CDATA section.
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
TiXmlText(const char *initValue)
Constructor for text element.
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Any tag that tinyXml doesn't recognize is saved as an unknown.
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
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 ...
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept()...
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
virtual bool Visit(const TiXmlText &)
Visit a text node.
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
virtual bool Visit(const TiXmlUnknown &)
Visit an unknow node.
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.