25 #ifndef TINYXML2_INCLUDED
26 #define TINYXML2_INCLUDED
28 #if defined(ANDROID_NDK) || defined(__BORLANDC__)
55 #if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
62 # pragma warning(push)
63 # pragma warning(disable: 4251)
67 # ifdef TINYXML2_EXPORT
68 # define TINYXML2_LIB __declspec(dllexport)
69 # elif defined(TINYXML2_IMPORT)
70 # define TINYXML2_LIB __declspec(dllimport)
80 # if defined(_MSC_VER)
81 # define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
82 # elif defined (ANDROID_NDK)
83 # include <android/log.h>
84 # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
87 # define TIXMLASSERT assert
90 # define TIXMLASSERT( x ) {}
94 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
103 inline int TIXML_SNPRINTF(
char* buffer,
size_t size,
const char* format, ... )
106 va_start( va, format );
107 int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
111 #define TIXML_SSCANF sscanf_s
115 #define TIXML_SNPRINTF snprintf
116 #define TIXML_SSCANF sscanf
122 static const int TIXML2_MAJOR_VERSION = 2;
123 static const int TIXML2_MINOR_VERSION = 1;
124 static const int TIXML2_PATCH_VERSION = 0;
133 class XMLDeclaration;
147 NEEDS_ENTITY_PROCESSING = 0x01,
148 NEEDS_NEWLINE_NORMALIZATION = 0x02,
149 COLLAPSE_WHITESPACE = 0x04,
151 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
152 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
154 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
155 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
156 COMMENT = NEEDS_NEWLINE_NORMALIZATION
159 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
162 void Set(
char* start,
char* end,
int flags ) {
166 _flags = flags | NEEDS_FLUSH;
169 const char* GetStr();
172 return _start == _end;
175 void SetInternedStr(
const char* str ) {
177 _start =
const_cast<char*
>(str);
180 void SetStr(
const char* str,
int flags=0 );
182 char* ParseText(
char* in,
const char* endTag,
int strFlags );
183 char* ParseName(
char* in );
187 void CollapseWhitespace();
206 template <
class T,
int INIT>
210 DynArray< T, INIT >() {
217 if ( _mem != _pool ) {
227 EnsureCapacity( _size+1 );
231 T* PushArr(
int count ) {
232 EnsureCapacity( _size+count );
233 T* ret = &_mem[_size];
239 return _mem[--_size];
242 void PopArr(
int count ) {
243 TIXMLASSERT( _size >= count );
251 T& operator[](
int i) {
252 TIXMLASSERT( i>= 0 && i < _size );
256 const T& operator[](
int i)
const {
257 TIXMLASSERT( i>= 0 && i < _size );
261 const T& PeekTop()
const {
262 TIXMLASSERT( _size > 0 );
263 return _mem[ _size - 1];
270 int Capacity()
const {
274 const T* Mem()
const {
283 void EnsureCapacity(
int cap ) {
284 if ( cap > _allocated ) {
285 int newAllocated = cap * 2;
286 T* newMem =
new T[newAllocated];
287 memcpy( newMem, _mem,
sizeof(T)*_size );
288 if ( _mem != _pool ) {
292 _allocated = newAllocated;
311 virtual ~MemPool() {}
313 virtual int ItemSize()
const = 0;
314 virtual void* Alloc() = 0;
315 virtual void Free(
void* ) = 0;
316 virtual void SetTracked() = 0;
324 class MemPoolT :
public MemPool
327 MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
330 for(
int i=0; i<_blockPtrs.Size(); ++i ) {
331 delete _blockPtrs[i];
335 virtual int ItemSize()
const {
338 int CurrentAllocs()
const {
339 return _currentAllocs;
342 virtual void* Alloc() {
345 Block* block =
new Block();
346 _blockPtrs.Push( block );
348 for(
int i=0; i<COUNT-1; ++i ) {
349 block->chunk[i].next = &block->chunk[i+1];
351 block->chunk[COUNT-1].next = 0;
352 _root = block->chunk;
354 void* result = _root;
358 if ( _currentAllocs > _maxAllocs ) {
359 _maxAllocs = _currentAllocs;
365 virtual void Free(
void* mem ) {
370 Chunk* chunk = (Chunk*)mem;
372 memset( chunk, 0xfe,
sizeof(Chunk) );
377 void Trace(
const char* name ) {
378 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
379 name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() );
386 int Untracked()
const {
399 enum { COUNT = (4*1024)/SIZE };
409 DynArray< Block*, 10 > _blockPtrs;
489 static const char* SkipWhiteSpace(
const char* p ) {
490 while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<const unsigned char*>(p) ) ) {
495 static char* SkipWhiteSpace(
char* p ) {
496 while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<unsigned char*>(p) ) ) {
501 static bool IsWhiteSpace(
char p ) {
502 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
505 inline static bool IsNameStartChar(
unsigned char ch ) {
506 return ( ( ch < 128 ) ? isalpha( ch ) : 1 )
511 inline static bool IsNameChar(
unsigned char ch ) {
512 return IsNameStartChar( ch )
518 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
523 while( *p && *q && *p == *q && n<nChar ) {
528 if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {
534 inline static int IsUTF8Continuation(
const char p ) {
538 static const char* ReadBOM(
const char* p,
bool* hasBOM );
541 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
542 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
545 static void ToStr(
int v,
char* buffer,
int bufferSize );
546 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
547 static void ToStr(
bool v,
char* buffer,
int bufferSize );
548 static void ToStr(
float v,
char* buffer,
int bufferSize );
549 static void ToStr(
double v,
char* buffer,
int bufferSize );
552 static bool ToInt(
const char* str,
int* value );
553 static bool ToUnsigned(
const char* str,
unsigned* value );
554 static bool ToBool(
const char* str,
bool* value );
555 static bool ToFloat(
const char* str,
float* value );
556 static bool ToDouble(
const char* str,
double* value );
628 virtual const XMLText* ToText()
const {
631 virtual const XMLComment* ToComment()
const {
634 virtual const XMLDocument* ToDocument()
const {
637 virtual const XMLDeclaration* ToDeclaration()
const {
640 virtual const XMLUnknown* ToUnknown()
const {
653 const char* Value()
const;
658 void SetValue(
const char* val,
bool staticMem=
false );
686 const XMLElement* FirstChildElement(
const char* value=0 )
const;
688 XMLElement* FirstChildElement(
const char* value=0 ) {
689 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( value ));
698 return const_cast<XMLNode*
>(
const_cast<const XMLNode*
>(
this)->LastChild() );
704 const XMLElement* LastChildElement(
const char* value=0 )
const;
706 XMLElement* LastChildElement(
const char* value=0 ) {
707 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(value) );
720 const XMLElement* PreviousSiblingElement(
const char* value=0 )
const ;
722 XMLElement* PreviousSiblingElement(
const char* value=0 ) {
723 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( value ) );
736 const XMLElement* NextSiblingElement(
const char* value=0 )
const;
738 XMLElement* NextSiblingElement(
const char* value=0 ) {
739 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( value ) );
749 XMLNode* InsertEndChild( XMLNode* addThis );
751 XMLNode* LinkEndChild( XMLNode* addThis ) {
752 return InsertEndChild( addThis );
761 XMLNode* InsertFirstChild( XMLNode* addThis );
770 XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );
775 void DeleteChildren();
780 void DeleteChild( XMLNode* node );
791 virtual XMLNode* ShallowClone( XMLDocument* document )
const = 0;
799 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
823 virtual bool Accept( XMLVisitor* visitor )
const = 0;
826 virtual char* ParseDeep(
char*, StrPair* );
829 XMLNode( XMLDocument* );
831 XMLNode(
const XMLNode& );
832 XMLNode& operator=(
const XMLNode& );
834 XMLDocument* _document;
836 mutable StrPair _value;
838 XMLNode* _firstChild;
846 void Unlink( XMLNode* child );
864 friend class XMLBase;
867 virtual bool Accept(
XMLVisitor* visitor )
const;
872 virtual const XMLText* ToText()
const {
885 char* ParseDeep(
char*, StrPair* endTag );
887 virtual bool ShallowEqual(
const XMLNode* compare )
const;
891 virtual ~XMLText() {}
892 XMLText(
const XMLText& );
893 XMLText& operator=(
const XMLText& );
912 virtual bool Accept( XMLVisitor* visitor )
const;
914 char* ParseDeep(
char*, StrPair* endTag );
915 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
916 virtual bool ShallowEqual(
const XMLNode* compare )
const;
919 XMLComment( XMLDocument* doc );
920 virtual ~XMLComment();
921 XMLComment(
const XMLComment& );
922 XMLComment& operator=(
const XMLComment& );
950 virtual bool Accept( XMLVisitor* visitor )
const;
952 char* ParseDeep(
char*, StrPair* endTag );
953 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
954 virtual bool ShallowEqual(
const XMLNode* compare )
const;
957 XMLDeclaration( XMLDocument* doc );
958 virtual ~XMLDeclaration();
959 XMLDeclaration(
const XMLDeclaration& );
960 XMLDeclaration& operator=(
const XMLDeclaration& );
982 virtual bool Accept( XMLVisitor* visitor )
const;
984 char* ParseDeep(
char*, StrPair* endTag );
985 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
986 virtual bool ShallowEqual(
const XMLNode* compare )
const;
989 XMLUnknown( XMLDocument* doc );
990 virtual ~XMLUnknown();
991 XMLUnknown(
const XMLUnknown& );
992 XMLUnknown& operator=(
const XMLUnknown& );
1001 XML_WRONG_ATTRIBUTE_TYPE,
1003 XML_ERROR_FILE_NOT_FOUND,
1004 XML_ERROR_FILE_COULD_NOT_BE_OPENED,
1005 XML_ERROR_FILE_READ_ERROR,
1006 XML_ERROR_ELEMENT_MISMATCH,
1007 XML_ERROR_PARSING_ELEMENT,
1008 XML_ERROR_PARSING_ATTRIBUTE,
1009 XML_ERROR_IDENTIFYING_TAG,
1010 XML_ERROR_PARSING_TEXT,
1011 XML_ERROR_PARSING_CDATA,
1012 XML_ERROR_PARSING_COMMENT,
1013 XML_ERROR_PARSING_DECLARATION,
1014 XML_ERROR_PARSING_UNKNOWN,
1015 XML_ERROR_EMPTY_DOCUMENT,
1016 XML_ERROR_MISMATCHED_ELEMENT,
1019 XML_CAN_NOT_CONVERT_TEXT,
1035 const char* Name()
const;
1038 const char* Value()
const;
1051 QueryIntValue( &i );
1057 QueryUnsignedValue( &i );
1063 QueryBoolValue( &b );
1069 QueryDoubleValue( &d );
1075 QueryFloatValue( &f );
1083 XMLError QueryIntValue(
int* value )
const;
1085 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1087 XMLError QueryBoolValue(
bool* value )
const;
1089 XMLError QueryDoubleValue(
double* value )
const;
1091 XMLError QueryFloatValue(
float* value )
const;
1094 void SetAttribute(
const char* value );
1096 void SetAttribute(
int value );
1098 void SetAttribute(
unsigned value );
1100 void SetAttribute(
bool value );
1102 void SetAttribute(
double value );
1104 void SetAttribute(
float value );
1107 enum { BUF_SIZE = 200 };
1109 XMLAttribute() : _next( 0 ), _memPool( 0 ) {}
1110 virtual ~XMLAttribute() {}
1112 XMLAttribute(
const XMLAttribute& );
1113 void operator=(
const XMLAttribute& );
1114 void SetName(
const char* name );
1116 char* ParseDeep(
char* p,
bool processEntities );
1118 mutable StrPair _name;
1119 mutable StrPair _value;
1120 XMLAttribute* _next;
1131 friend class XMLBase;
1139 void SetName(
const char* str,
bool staticMem=
false ) {
1140 SetValue( str, staticMem );
1146 virtual const XMLElement* ToElement()
const {
1149 virtual bool Accept( XMLVisitor* visitor )
const;
1174 const char* Attribute(
const char* name,
const char* value=0 )
const;
1183 QueryIntAttribute( name, &i );
1189 QueryUnsignedAttribute( name, &i );
1195 QueryBoolAttribute( name, &b );
1201 QueryDoubleAttribute( name, &d );
1207 QueryFloatAttribute( name, &f );
1227 return XML_NO_ATTRIBUTE;
1235 return XML_NO_ATTRIBUTE;
1243 return XML_NO_ATTRIBUTE;
1251 return XML_NO_ATTRIBUTE;
1259 return XML_NO_ATTRIBUTE;
1283 return QueryIntAttribute( name, value );
1286 int QueryAttribute(
const char* name,
unsigned int* value )
const {
1287 return QueryUnsignedAttribute( name, value );
1290 int QueryAttribute(
const char* name,
bool* value )
const {
1291 return QueryBoolAttribute( name, value );
1294 int QueryAttribute(
const char* name,
double* value )
const {
1295 return QueryDoubleAttribute( name, value );
1298 int QueryAttribute(
const char* name,
float* value )
const {
1299 return QueryFloatAttribute( name, value );
1336 void DeleteAttribute(
const char* name );
1340 return _rootAttribute;
1343 const XMLAttribute* FindAttribute(
const char* name )
const;
1373 const char* GetText()
const;
1409 void SetText(
const char* inText );
1411 void SetText(
int value );
1413 void SetText(
unsigned value );
1415 void SetText(
bool value );
1417 void SetText(
double value );
1419 void SetText(
float value );
1447 XMLError QueryIntText(
int* ival )
const;
1449 XMLError QueryUnsignedText(
unsigned* uval )
const;
1451 XMLError QueryBoolText(
bool* bval )
const;
1453 XMLError QueryDoubleText(
double* dval )
const;
1455 XMLError QueryFloatText(
float* fval )
const;
1463 int ClosingType()
const {
1464 return _closingType;
1466 char* ParseDeep(
char* p, StrPair* endTag );
1467 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1468 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1471 XMLElement( XMLDocument* doc );
1472 virtual ~XMLElement();
1473 XMLElement(
const XMLElement& );
1474 void operator=(
const XMLElement& );
1476 XMLAttribute* FindAttribute(
const char* name );
1477 XMLAttribute* FindOrCreateAttribute(
const char* name );
1479 char* ParseAttributes(
char* p );
1481 enum { BUF_SIZE = 200 };
1486 XMLAttribute* _rootAttribute;
1491 PRESERVE_WHITESPACE,
1506 XMLDocument(
bool processEntities =
true, Whitespace = PRESERVE_WHITESPACE );
1526 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1533 XMLError LoadFile(
const char* filename );
1542 XMLError LoadFile( FILE* );
1549 XMLError SaveFile(
const char* filename,
bool compact =
false );
1558 XMLError SaveFile( FILE* fp,
bool compact =
false );
1560 bool ProcessEntities()
const {
1561 return _processEntities;
1563 Whitespace WhitespaceMode()
const {
1583 return FirstChildElement();
1586 return FirstChildElement();
1603 void Print( XMLPrinter* streamer=0 )
const;
1604 virtual bool Accept( XMLVisitor* visitor )
const;
1611 XMLElement* NewElement(
const char* name );
1617 XMLComment* NewComment(
const char* comment );
1623 XMLText* NewText(
const char* text );
1635 XMLDeclaration* NewDeclaration(
const char* text=0 );
1641 XMLUnknown* NewUnknown(
const char* text );
1651 void SetError( XMLError error,
const char* str1,
const char* str2 );
1655 return _errorID != XML_NO_ERROR;
1670 void PrintError()
const;
1676 char* Identify(
char* p,
XMLNode** node );
1690 bool _processEntities;
1692 Whitespace _whitespace;
1693 const char* _errorStr1;
1694 const char* _errorStr2;
1697 MemPoolT< sizeof(XMLElement) > _elementPool;
1698 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1699 MemPoolT< sizeof(XMLText) > _textPool;
1700 MemPoolT< sizeof(XMLComment) > _commentPool;
1782 return XMLHandle( _node ? _node->FirstChild() : 0 );
1786 return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 );
1790 return XMLHandle( _node ? _node->LastChild() : 0 );
1794 return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 );
1798 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1802 return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 );
1806 return XMLHandle( _node ? _node->NextSibling() : 0 );
1810 return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 );
1819 return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 );
1823 return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 );
1827 return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 );
1831 return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 );
1864 const XMLConstHandle FirstChildElement(
const char* value=0 )
const {
1865 return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 );
1870 const XMLConstHandle LastChildElement(
const char* _value=0 )
const {
1871 return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 );
1876 const XMLConstHandle PreviousSiblingElement(
const char* _value=0 )
const {
1877 return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 );
1882 const XMLConstHandle NextSiblingElement(
const char* _value=0 )
const {
1883 return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 );
1887 const XMLNode* ToNode()
const {
1891 return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 );
1893 const XMLText* ToText()
const {
1894 return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 );
1897 return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 );
1900 return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 );
1959 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
1963 void PushHeader(
bool writeBOM,
bool writeDeclaration );
1967 void OpenElement(
const char* name,
bool compactMode=
false );
1969 void PushAttribute(
const char* name,
const char* value );
1970 void PushAttribute(
const char* name,
int value );
1971 void PushAttribute(
const char* name,
unsigned value );
1972 void PushAttribute(
const char* name,
bool value );
1973 void PushAttribute(
const char* name,
double value );
1975 virtual void CloseElement(
bool compactMode=
false );
1978 void PushText(
const char* text,
bool cdata=
false );
1980 void PushText(
int value );
1982 void PushText(
unsigned value );
1984 void PushText(
bool value );
1986 void PushText(
float value );
1988 void PushText(
double value );
1991 void PushComment(
const char* comment );
1993 void PushDeclaration(
const char* value );
1994 void PushUnknown(
const char* value );
2002 virtual bool VisitExit(
const XMLElement& element );
2004 virtual bool Visit(
const XMLText& text );
2005 virtual bool Visit(
const XMLComment& comment );
2007 virtual bool Visit(
const XMLUnknown& unknown );
2014 return _buffer.Mem();
2022 return _buffer.Size();
2034 virtual bool CompactMode(
const XMLElement& ) {
return _compactMode; };
2039 virtual void PrintSpace(
int depth );
2040 void Print(
const char* format, ... );
2043 bool _elementJustOpened;
2044 DynArray< const char*, 10 > _stack;
2047 void PrintString(
const char*,
bool restrictedEntitySet );
2053 bool _processEntities;
2060 bool _entityFlag[ENTITY_RANGE];
2061 bool _restrictedEntityFlag[ENTITY_RANGE];
2063 DynArray< char, 20 > _buffer;
2065 DynArray< char, 20 > _accumulator;
2072 #if defined(_MSC_VER)
2073 # pragma warning(pop)
2076 #endif // TINYXML2_INCLUDED
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:881
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:661
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:449
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1681
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:1822
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1240
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:1818
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:601
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1067
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:605
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:670
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1658
int CStrSize() const
Definition: tinyxml2.h:2021
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1509
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:693
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:1826
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1771
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1781
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:877
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1789
Definition: tinyxml2.h:1759
Definition: tinyxml2.h:939
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1232
XMLElement * RootElement()
Definition: tinyxml2.h:1582
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1135
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:869
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1767
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1139
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1575
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1763
XMLError QueryIntValue(int *value) const
double DoubleAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1199
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1282
void ClearBuffer()
Definition: tinyxml2.h:2028
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1143
Definition: tinyxml2.h:126
bool HasBOM() const
Definition: tinyxml2.h:1570
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1814
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1187
void DeleteNode(XMLNode *node)
Definition: tinyxml2.h:1647
bool BoolAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1193
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1061
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:943
void DeleteChild(XMLNode *node)
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1256
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:463
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:475
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1313
Definition: tinyxml2.h:1129
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1805
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:975
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1797
Definition: tinyxml2.h:1843
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1775
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:1997
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:454
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:592
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1678
XMLHandle FirstChildElement(const char *value=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1785
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:445
Definition: tinyxml2.h:971
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:727
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:613
Definition: tinyxml2.h:1030
float FloatAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1205
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
Definition: tinyxml2.h:1666
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1318
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:1830
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1055
XMLHandle NextSiblingElement(const char *_value=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1809
void SetAttribute(const char *value)
Set the attribute to a string value.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1303
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:458
Definition: tinyxml2.h:1950
Definition: tinyxml2.h:1501
const char * CStr() const
Definition: tinyxml2.h:2013
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1224
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1323
int IntValue() const
Definition: tinyxml2.h:1049
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:471
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1041
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
Definition: tinyxml2.h:1662
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1654
Definition: tinyxml2.h:585
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:711
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1073
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
XMLHandle PreviousSiblingElement(const char *_value=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1801
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:467
Definition: tinyxml2.h:862
Definition: tinyxml2.h:439
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:596
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:621
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1248
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1328
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:675
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:617
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1339
int IntAttribute(const char *name) const
Definition: tinyxml2.h:1181
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1308
XMLHandle LastChildElement(const char *_value=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1793
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:609