Go to the documentation of this file.
24 #ifndef TINYXML2_INCLUDED
25 #define TINYXML2_INCLUDED
27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
57 #if defined(_DEBUG) || defined(__DEBUG__)
58 # ifndef TINYXML2_DEBUG
59 # define TINYXML2_DEBUG
64 # pragma warning(push)
65 # pragma warning(disable : 4251)
69 # ifdef TINYXML2_EXPORT
70 # define TINYXML2_LIB __declspec(dllexport)
71 # elif defined(TINYXML2_IMPORT)
72 # define TINYXML2_LIB __declspec(dllimport)
77 # define TINYXML2_LIB __attribute__((visibility("default")))
83 #if !defined(TIXMLASSERT)
84 # if defined(TINYXML2_DEBUG)
85 # if defined(_MSC_VER)
86 # // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
87 # define TIXMLASSERT(x) \
88 if (!((void)0, (x))) \
92 # elif defined(ANDROID_NDK)
93 # include <android/log.h>
94 # define TIXMLASSERT(x) \
97 __android_log_assert("assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__); \
101 # define TIXMLASSERT assert
104 # define TIXMLASSERT(x) \
117 #define TINYXML2_MAJOR_VERSION 9
118 #define TINYXML2_MINOR_VERSION 0
119 #define TINYXML2_PATCH_VERSION 0
151 NEEDS_ENTITY_PROCESSING = 0x01,
152 NEEDS_NEWLINE_NORMALIZATION = 0x02,
153 NEEDS_WHITESPACE_COLLAPSING = 0x04,
155 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
156 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
158 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
159 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
160 COMMENT = NEEDS_NEWLINE_NORMALIZATION
171 void Set(
char* start,
char* end,
int flags)
178 _flags = flags | NEEDS_FLUSH;
181 const char* GetStr();
183 bool Empty()
const {
return _start == _end; }
188 _start =
const_cast<char*
>(str);
191 void SetStr(
const char* str,
int flags = 0);
193 char* ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr);
194 char* ParseName(
char* in);
196 void TransferTo(
StrPair* other);
200 void CollapseWhitespace();
213 void operator=(
const StrPair& other);
222 template <
class T,
int INITIAL_SIZE>
336 const int newAllocated = cap * 2;
337 T* newMem =
new T[newAllocated];
368 virtual void*
Alloc() = 0;
369 virtual void Free(
void*) = 0;
377 template <
int ITEM_SIZE>
415 Block* block =
new Block();
418 Item* blockItems = block->items;
421 blockItems[i].next = &(blockItems[i + 1]);
426 Item*
const result =
_root;
447 Item* item =
static_cast<Item*
>(mem);
448 #ifdef TINYXML2_DEBUG
449 memset(item, 0xfe,
sizeof(*item));
456 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
593 while (IsWhiteSpace(*p))
595 if (curLineNumPtr && *p ==
'\n')
606 return const_cast<char*
>(SkipWhiteSpace(
const_cast<const char*
>(p), curLineNumPtr));
613 return !IsUTF8Continuation(p) && isspace(
static_cast<unsigned char>(p));
627 return ch ==
':' || ch ==
'_';
632 return IsNameStartChar(ch) || isdigit(ch) || ch ==
'.' || ch ==
'-';
637 p = SkipWhiteSpace(p, 0);
638 return p && *p ==
'0' && (*(p + 1) ==
'x' || *(p + 1) ==
'X');
641 inline static bool StringEqual(
const char* p,
const char* q,
int nChar = INT_MAX)
650 return strncmp(p, q, nChar) == 0;
655 static const char* ReadBOM(
const char* p,
bool* hasBOM);
658 static const char* GetCharacterRef(
const char* p,
char* value,
int* length);
659 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length);
662 static void ToStr(
int v,
char* buffer,
int bufferSize);
663 static void ToStr(
unsigned v,
char* buffer,
int bufferSize);
664 static void ToStr(
bool v,
char* buffer,
int bufferSize);
665 static void ToStr(
float v,
char* buffer,
int bufferSize);
666 static void ToStr(
double v,
char* buffer,
int bufferSize);
667 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
668 static void ToStr(uint64_t v,
char* buffer,
int bufferSize);
671 static bool ToInt(
const char* str,
int* value);
672 static bool ToUnsigned(
const char* str,
unsigned* value);
673 static bool ToBool(
const char* str,
bool* value);
674 static bool ToFloat(
const char* str,
float* value);
675 static bool ToDouble(
const char* str,
double* value);
676 static bool ToInt64(
const char* str, int64_t* value);
677 static bool ToUnsigned64(
const char* str, uint64_t* value);
683 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
764 const char* Value()
const;
769 void SetValue(
const char* val,
bool staticMem =
false);
790 const XMLElement* FirstChildElement(
const char* name = 0)
const;
794 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement(name));
805 const XMLElement* LastChildElement(
const char* name = 0)
const;
809 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name));
818 const XMLElement* PreviousSiblingElement(
const char* name = 0)
const;
822 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement(name));
831 const XMLElement* NextSiblingElement(
const char* name = 0)
const;
835 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement(name));
869 void DeleteChildren();
874 void DeleteChild(
XMLNode* node);
908 virtual bool ShallowEqual(
const XMLNode* compare)
const = 0;
932 virtual bool Accept(
XMLVisitor* visitor)
const = 0;
952 virtual char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
970 static void DeleteNode(
XMLNode* node);
971 void InsertChildPreamble(
XMLNode* insertThis)
const;
972 const XMLElement* ToElementWithName(
const char* name)
const;
996 virtual bool Accept(
XMLVisitor* visitor)
const;
1007 virtual bool ShallowEqual(
const XMLNode* compare)
const;
1017 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1036 virtual bool Accept(
XMLVisitor* visitor)
const;
1039 virtual bool ShallowEqual(
const XMLNode* compare)
const;
1045 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1072 virtual bool Accept(
XMLVisitor* visitor)
const;
1075 virtual bool ShallowEqual(
const XMLNode* compare)
const;
1081 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1104 virtual bool Accept(
XMLVisitor* visitor)
const;
1107 virtual bool ShallowEqual(
const XMLNode* compare)
const;
1113 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1133 const char* Name()
const;
1136 const char* Value()
const;
1158 QueryInt64Value(&i);
1165 QueryUnsigned64Value(&i);
1173 QueryUnsignedValue(&i);
1187 QueryDoubleValue(&d);
1194 QueryFloatValue(&f);
1202 XMLError QueryIntValue(
int* value)
const;
1204 XMLError QueryUnsignedValue(
unsigned int* value)
const;
1206 XMLError QueryInt64Value(int64_t* value)
const;
1208 XMLError QueryUnsigned64Value(uint64_t* value)
const;
1210 XMLError QueryBoolValue(
bool* value)
const;
1212 XMLError QueryDoubleValue(
double* value)
const;
1214 XMLError QueryFloatValue(
float* value)
const;
1217 void SetAttribute(
const char* value);
1219 void SetAttribute(
int value);
1221 void SetAttribute(
unsigned value);
1223 void SetAttribute(int64_t value);
1225 void SetAttribute(uint64_t value);
1227 void SetAttribute(
bool value);
1229 void SetAttribute(
double value);
1231 void SetAttribute(
float value);
1251 void SetName(
const char* name);
1253 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr);
1273 const char*
Name()
const {
return Value(); }
1275 void SetName(
const char* str,
bool staticMem =
false) { SetValue(str, staticMem); }
1279 virtual bool Accept(
XMLVisitor* visitor)
const;
1304 const char* Attribute(
const char* name,
const char* value = 0)
const;
1312 int IntAttribute(
const char* name,
int defaultValue = 0)
const;
1314 unsigned UnsignedAttribute(
const char* name,
unsigned defaultValue = 0)
const;
1316 int64_t Int64Attribute(
const char* name, int64_t defaultValue = 0)
const;
1318 uint64_t Unsigned64Attribute(
const char* name, uint64_t defaultValue = 0)
const;
1320 bool BoolAttribute(
const char* name,
bool defaultValue =
false)
const;
1322 double DoubleAttribute(
const char* name,
double defaultValue = 0)
const;
1324 float FloatAttribute(
const char* name,
float defaultValue = 0)
const;
1421 *value = a->
Value();
1445 return QueryIntAttribute(name, value);
1450 return QueryUnsignedAttribute(name, value);
1455 return QueryInt64Attribute(name, value);
1460 return QueryUnsigned64Attribute(name, value);
1465 return QueryBoolAttribute(name, value);
1470 return QueryDoubleAttribute(name, value);
1475 return QueryFloatAttribute(name, value);
1480 return QueryStringAttribute(name, value);
1538 void DeleteAttribute(
const char* name);
1543 const XMLAttribute* FindAttribute(
const char* name)
const;
1573 const char* GetText()
const;
1609 void SetText(
const char* inText);
1612 void SetText(
int value);
1615 void SetText(
unsigned value);
1618 void SetText(int64_t value);
1621 void SetText(uint64_t value);
1624 void SetText(
bool value);
1627 void SetText(
double value);
1630 void SetText(
float value);
1658 XMLError QueryIntText(
int* ival)
const;
1660 XMLError QueryUnsignedText(
unsigned* uval)
const;
1662 XMLError QueryInt64Text(int64_t* uval)
const;
1664 XMLError QueryUnsigned64Text(uint64_t* uval)
const;
1666 XMLError QueryBoolText(
bool* bval)
const;
1668 XMLError QueryDoubleText(
double* dval)
const;
1670 XMLError QueryFloatText(
float* fval)
const;
1672 int IntText(
int defaultValue = 0)
const;
1675 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1677 int64_t Int64Text(int64_t defaultValue = 0)
const;
1679 uint64_t Unsigned64Text(uint64_t defaultValue = 0)
const;
1681 bool BoolText(
bool defaultValue =
false)
const;
1683 double DoubleText(
double defaultValue = 0)
const;
1685 float FloatText(
float defaultValue = 0)
const;
1691 XMLElement* InsertNewChildElement(
const char* name);
1693 XMLComment* InsertNewComment(
const char* comment);
1695 XMLText* InsertNewText(
const char* text);
1699 XMLUnknown* InsertNewUnknown(
const char* text);
1711 virtual bool ShallowEqual(
const XMLNode* compare)
const;
1714 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1723 char* ParseAttributes(
char* p,
int* curLineNumPtr);
1788 XMLError Parse(
const char* xml,
size_t nBytes =
static_cast<size_t>(-1));
1795 XMLError LoadFile(
const char* filename);
1815 XMLError SaveFile(
const char* filename,
bool compact =
false);
1824 XMLError SaveFile(FILE* fp,
bool compact =
false);
1835 void SetBOM(
bool useBOM) { _writeBOM = useBOM; }
1858 virtual bool Accept(
XMLVisitor* visitor)
const;
1877 XMLText* NewText(
const char* text);
1901 void DeleteNode(
XMLNode* node);
1910 const char* ErrorName()
const;
1911 static const char* ErrorIDToName(
XMLError errorID);
1916 const char* ErrorStr()
const;
1919 void PrintError()
const;
1937 char* Identify(
char* p,
XMLNode** node);
1940 void MarkInUse(
const XMLNode*
const);
1975 void SetError(
XMLError error,
int lineNum,
const char* format, ...);
1985 this->_document = document;
1996 template <
class NodeType,
int PoolElementSize>
2000 template <
class NodeType,
int PoolElementSize>
2005 NodeType* returnNode =
new (pool.
Alloc()) NodeType(
this);
2007 returnNode->_memPool = &pool;
2098 return XMLHandle(_node ? _node->FirstChildElement(name) : 0);
2105 return XMLHandle(_node ? _node->LastChildElement(name) : 0);
2112 return XMLHandle(_node ? _node->PreviousSiblingElement(name) : 0);
2119 return XMLHandle(_node ? _node->NextSiblingElement(name) : 0);
2170 return XMLConstHandle(_node ? _node->FirstChildElement(name) : 0);
2175 return XMLConstHandle(_node ? _node->LastChildElement(name) : 0);
2183 return XMLConstHandle(_node ? _node->PreviousSiblingElement(name) : 0);
2191 return XMLConstHandle(_node ? _node->NextSiblingElement(name) : 0);
2257 XMLPrinter(FILE* file = 0,
bool compact =
false,
int depth = 0);
2261 void PushHeader(
bool writeBOM,
bool writeDeclaration);
2265 void OpenElement(
const char* name,
bool compactMode =
false);
2267 void PushAttribute(
const char* name,
const char* value);
2268 void PushAttribute(
const char* name,
int value);
2269 void PushAttribute(
const char* name,
unsigned value);
2270 void PushAttribute(
const char* name, int64_t value);
2271 void PushAttribute(
const char* name, uint64_t value);
2272 void PushAttribute(
const char* name,
bool value);
2273 void PushAttribute(
const char* name,
double value);
2275 virtual void CloseElement(
bool compactMode =
false);
2278 void PushText(
const char* text,
bool cdata =
false);
2280 void PushText(
int value);
2282 void PushText(
unsigned value);
2284 void PushText(int64_t value);
2286 void PushText(uint64_t value);
2288 void PushText(
bool value);
2290 void PushText(
float value);
2292 void PushText(
double value);
2295 void PushComment(
const char* comment);
2297 void PushDeclaration(
const char* value);
2298 void PushUnknown(
const char* value);
2304 virtual bool VisitExit(
const XMLElement& element);
2306 virtual bool Visit(
const XMLText& text);
2307 virtual bool Visit(
const XMLComment& comment);
2309 virtual bool Visit(
const XMLUnknown& unknown);
2315 const char*
CStr()
const {
return _buffer.Mem(); }
2330 _firstElement = resetToFirstElement;
2339 virtual void PrintSpace(
int depth);
2340 virtual void Print(
const char* format, ...);
2341 virtual void Write(
const char* data,
size_t size);
2342 virtual void Putc(
char ch);
2344 inline void Write(
const char* data) {
Write(data, strlen(data)); }
2346 void SealElementIfJustOpened();
2355 void PrepareForNewNode(
bool compactMode);
2356 void PrintString(
const char*,
bool restrictedEntitySet);
2370 bool _entityFlag[ENTITY_RANGE];
2371 bool _restrictedEntityFlag[ENTITY_RANGE];
2383 #if defined(_MSC_VER)
2384 # pragma warning(pop)
2387 #endif // TINYXML2_INCLUDED
void operator=(const DynArray &)
virtual void SetTracked()=0
virtual const XMLDocument * ToDocument() const
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
const XMLText * ToText() const
virtual const XMLText * ToText() const
XMLError QueryUnsigned64Attribute(const char *name, uint64_t *value) const
See QueryIntAttribute()
bool Error() const
Return true if there was an error parsing the document.
virtual bool Visit(const XMLComment &)
Visit a comment node.
const char * Value() const
The value of the attribute.
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
Item items[ITEMS_PER_BLOCK]
bool CData() const
Returns true if this is a CDATA text element.
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
XMLAttribute * _rootAttribute
const XMLNode * ToNode() const
void SetAttribute(const char *value)
Set the attribute to a string value.
XMLHandle(const XMLHandle &ref)
Copy constructor.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
static char * SkipWhiteSpace(char *const p, int *curLineNumPtr)
void Trace(const char *name)
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
@ XML_ERROR_PARSING_UNKNOWN
virtual void Free(void *mem)
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
bool NoChildren() const
Returns true if this node has no children.
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
@ XML_ERROR_FILE_NOT_FOUND
virtual XMLNode * ShallowClone(XMLDocument *) const
DynArray< const char *, 10 > _stack
virtual const XMLElement * ToElement() const
@ XML_ERROR_FILE_COULD_NOT_BE_OPENED
@ XML_WRONG_ATTRIBUTE_TYPE
NodeType * CreateUnlinkedNode(MemPoolT< PoolElementSize > &pool)
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
virtual int ItemSize() const =0
const T & PeekTop() const
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
static const int TIXML2_MAJOR_VERSION
double DoubleValue() const
Query as a double. See IntValue()
@ XML_ERROR_PARSING_DECLARATION
@ XML_ERROR_FILE_READ_ERROR
virtual const XMLUnknown * ToUnknown() const
@ XML_ERROR_PARSING_ELEMENT
XMLError ErrorID() const
Return the errorID.
XMLHandle(XMLNode &node)
Create a handle from a node.
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
XMLElement * FirstChildElement(const char *name=0)
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
const XMLDeclaration * ToDeclaration() const
Whitespace WhitespaceMode() const
virtual bool VisitExit(const XMLDocument &)
Visit a document.
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
static const int TIXML2_MINOR_VERSION
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
virtual const XMLComment * ToComment() const
virtual bool VisitExit(const XMLElement &)
Visit an element.
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
static const int TINYXML2_MAX_ELEMENT_DEPTH
const XMLElement * ToElement() const
Whitespace _whitespaceMode
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
XMLError QueryAttribute(const char *name, const char **value) const
@ XML_ERROR_PARSING_COMMENT
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
void Set(char *start, char *end, int flags)
XMLConstHandle(const XMLNode *node)
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
XMLError QueryAttribute(const char *name, uint64_t *value) const
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
const XMLConstHandle NextSibling() const
bool ProcessEntities() const
const XMLElement * RootElement() const
const char * CStr() const
ElementClosingType _closingType
const XMLConstHandle LastChildElement(const char *name=0) const
static const char * writeBoolTrue
void SetAttribute(const char *name, uint64_t value)
Sets the named attribute to value.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
DynArray< char, 20 > _buffer
static bool IsNameStartChar(unsigned char ch)
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
DynArray< XMLNode *, 10 > _unlinked
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
static const char * writeBoolFalse
DepthTracker(XMLDocument *document)
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
void SetInternedStr(const char *str)
XMLNode * LinkEndChild(XMLNode *addThis)
XMLText(XMLDocument *doc)
const XMLConstHandle FirstChild() const
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
XMLError QueryAttribute(const char *name, double *value) const
XMLError QueryAttribute(const char *name, unsigned int *value) const
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
const XMLUnknown * ToUnknown() const
XMLText * ToText()
Safe cast to XMLText. This can return null.
int CurrentAllocs() const
XMLHandle LastChild()
Get the last child of this handle.
ElementClosingType ClosingType() const
virtual const XMLDocument * ToDocument() const
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
@ XML_ERROR_PARSING_CDATA
DynArray< Block *, 10 > _blockPtrs
virtual bool CompactMode(const XMLElement &)
XMLElement * RootElement()
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
void SetUserData(void *userData)
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
static bool IsUTF8Continuation(const char p)
void * GetUserData() const
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
static bool IsPrefixHex(const char *p)
virtual int ItemSize() const
void ClearBuffer(bool resetToFirstElement=true)
virtual const XMLElement * ToElement() const
const XMLConstHandle LastChild() const
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
@ XML_ERROR_PARSING_ATTRIBUTE
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
XMLError QueryUnsigned64Value(uint64_t *value) const
See QueryIntValue.
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
const T & operator[](int i) const
const XMLConstHandle NextSiblingElement(const char *name=0) const
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
bool BoolValue() const
Query as a boolean. See IntValue()
virtual bool Visit(const XMLText &)
Visit a text node.
virtual void Free(void *)=0
XMLConstHandle & operator=(const XMLConstHandle &ref)
XMLElement * PreviousSiblingElement(const char *name=0)
virtual const XMLDeclaration * ToDeclaration() const
XMLElement * NextSiblingElement(const char *name=0)
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
XMLError QueryAttribute(const char *name, float *value) const
static bool IsWhiteSpace(char p)
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
XMLElement * LastChildElement(const char *name=0)
void Write(const char *data)
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLConstHandle(const XMLConstHandle &ref)
XMLError QueryIntAttribute(const char *name, int *value) const
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
@ XML_CAN_NOT_CONVERT_TEXT
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
void EnsureCapacity(int cap)
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file.
@ XML_ELEMENT_DEPTH_EXCEEDED
virtual XMLText * ToText()
Safely cast to Text, or null.
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
float FloatValue() const
Query as a float. See IntValue()
int64_t Int64Value() const
uint64_t Unsigned64Value() const
virtual const XMLText * ToText() const
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
@ XML_ERROR_MISMATCHED_ELEMENT
XMLError QueryAttribute(const char *name, int *value) const
static bool IsNameChar(unsigned char ch)
void operator=(const MemPoolT &)
const XMLConstHandle FirstChildElement(const char *name=0) const
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
virtual bool ShallowEqual(const XMLNode *) const
XMLError QueryAttribute(const char *name, bool *value) const
virtual const XMLUnknown * ToUnknown() const
static const int TIXML2_PATCH_VERSION
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
virtual const XMLDeclaration * ToDeclaration() const
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
XMLError QueryAttribute(const char *name, int64_t *value) const
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
XMLNode * PreviousSibling()
XMLConstHandle(const XMLNode &node)
@ XML_ERROR_EMPTY_DOCUMENT
XMLHandle NextSibling()
Get the next sibling of this handle.
XMLHandle FirstChild()
Get the first child of this handle.
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
XMLError QueryIntValue(int *value) const
const XMLAttribute * Next() const
The next attribute in the list.
const XMLConstHandle PreviousSibling() const
const char * Name() const
Get the name of an element (which is the Value() of the node.)