27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
35 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
44 static inline int TIXML_SNPRINTF(
char* buffer,
size_t size,
const char* format, ... )
47 va_start( va, format );
48 int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
53 static inline int TIXML_VSNPRINTF(
char* buffer,
size_t size,
const char* format, va_list va )
55 int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
59 #define TIXML_VSCPRINTF _vscprintf
60 #define TIXML_SSCANF sscanf_s
61 #elif defined _MSC_VER
63 #define TIXML_SNPRINTF _snprintf
64 #define TIXML_VSNPRINTF _vsnprintf
65 #define TIXML_SSCANF sscanf
66 #if (_MSC_VER < 1400 ) && (!defined WINCE)
68 #define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have.
71 static inline int TIXML_VSCPRINTF(
const char* format, va_list va )
76 char* str =
new char[len]();
77 const int required = _vsnprintf(str, len, format, va);
79 if ( required != -1 ) {
92 #define TIXML_SNPRINTF snprintf
93 #define TIXML_VSNPRINTF vsnprintf
94 static inline int TIXML_VSCPRINTF(
const char* format, va_list va )
96 int len = vsnprintf( 0, 0, format, va );
100 #define TIXML_SSCANF sscanf
104 static const char LINE_FEED = (char)0x0a;
105 static const char LF = LINE_FEED;
106 static const char CARRIAGE_RETURN = (char)0x0d;
107 static const char CR = CARRIAGE_RETURN;
108 static const char SINGLE_QUOTE =
'\'';
109 static const char DOUBLE_QUOTE =
'\"';
115 static const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
116 static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
117 static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
128 static const int NUM_ENTITIES = 5;
129 static const Entity entities[NUM_ENTITIES] = {
130 {
"quot", 4, DOUBLE_QUOTE },
132 {
"apos", 4, SINGLE_QUOTE },
146 if (
this == other ) {
158 other->_flags = _flags;
159 other->_start = _start;
167 void StrPair::Reset()
169 if ( _flags & NEEDS_DELETE ) {
182 size_t len = strlen( str );
184 _start =
new char[ len+1 ];
185 memcpy( _start, str, len+1 );
187 _flags = flags | NEEDS_DELETE;
196 char endChar = *endTag;
197 size_t length = strlen( endTag );
201 if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) {
202 Set( start, p, strFlags );
220 char*
const start = p;
231 void StrPair::CollapseWhitespace()
264 if ( _flags & NEEDS_FLUSH ) {
266 _flags ^= NEEDS_FLUSH;
277 if ( *(p+1) == LF ) {
285 else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
286 if ( *(p+1) == CR ) {
300 if ( *(p+1) ==
'#' ) {
301 const int buflen = 10;
302 char buf[buflen] = { 0 };
305 if ( adjusted == 0 ) {
314 memcpy( q, buf, len );
319 bool entityFound =
false;
320 for(
int i = 0; i < NUM_ENTITIES; ++i ) {
321 const Entity& entity = entities[i];
323 && *( p + entity.
length + 1 ) ==
';' ) {
332 if ( !entityFound ) {
350 CollapseWhitespace();
352 _flags = (_flags & NEEDS_DELETE);
368 const unsigned char* pu =
reinterpret_cast<const unsigned char*
>(p);
370 if ( *(pu+0) == TIXML_UTF_LEAD_0
371 && *(pu+1) == TIXML_UTF_LEAD_1
372 && *(pu+2) == TIXML_UTF_LEAD_2 ) {
383 const unsigned long BYTE_MASK = 0xBF;
384 const unsigned long BYTE_MARK = 0x80;
385 const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
390 else if ( input < 0x800 ) {
393 else if ( input < 0x10000 ) {
396 else if ( input < 0x200000 ) {
410 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
414 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
418 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
422 *output = (char)(input | FIRST_BYTE_MARK[*length]);
435 if ( *(p+1) ==
'#' && *(p+2) ) {
436 unsigned long ucs = 0;
440 static const char SEMICOLON =
';';
442 if ( *(p+2) ==
'x' ) {
449 q = strchr( q, SEMICOLON );
459 while ( *q !=
'x' ) {
460 unsigned int digit = 0;
462 if ( *q >=
'0' && *q <=
'9' ) {
465 else if ( *q >=
'a' && *q <=
'f' ) {
466 digit = *q -
'a' + 10;
468 else if ( *q >=
'A' && *q <=
'F' ) {
469 digit = *q -
'A' + 10;
475 TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
476 const unsigned int digitScaled = mult * digit;
491 q = strchr( q, SEMICOLON );
501 while ( *q !=
'#' ) {
502 if ( *q >=
'0' && *q <=
'9' ) {
503 const unsigned int digit = *q -
'0';
505 TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
506 const unsigned int digitScaled = mult * digit;
520 return p + delta + 1;
578 if (
ToInt( str, &ival )) {
579 *value = (ival==0) ?
false :
true;
615 char*
const start = p;
624 static const char* xmlHeader = {
"<?" };
625 static const char* commentHeader = {
"<!--" };
626 static const char* cdataHeader = {
"<![CDATA[" };
627 static const char* dtdHeader = {
"<!" };
628 static const char* elementHeader = {
"<" };
630 static const int xmlHeaderLen = 2;
631 static const int commentHeaderLen = 4;
632 static const int cdataHeaderLen = 9;
633 static const int dtdHeaderLen = 2;
634 static const int elementHeaderLen = 1;
642 returnNode->_memPool = &_commentPool;
647 returnNode =
new (_commentPool.Alloc())
XMLComment(
this );
648 returnNode->_memPool = &_commentPool;
649 p += commentHeaderLen;
655 returnNode->_memPool = &_textPool;
657 text->SetCData(
true );
661 returnNode =
new (_commentPool.Alloc())
XMLUnknown(
this );
662 returnNode->_memPool = &_commentPool;
667 returnNode =
new (_elementPool.Alloc())
XMLElement(
this );
668 returnNode->_memPool = &_elementPool;
669 p += elementHeaderLen;
673 returnNode =
new (_textPool.Alloc())
XMLText(
this );
674 returnNode->_memPool = &_textPool;
690 if ( !node->Accept( visitor ) ) {
704 _firstChild( 0 ), _lastChild( 0 ),
705 _prev( 0 ), _next( 0 ),
752 void XMLNode::Unlink(
XMLNode* child )
764 if ( child->
_prev ) {
767 if ( child->
_next ) {
791 InsertChildPreamble( addThis );
821 InsertChildPreamble( addThis );
855 if ( afterThis->
_parent !=
this ) {
860 if ( afterThis->
_next == 0 ) {
864 InsertChildPreamble( addThis );
865 addThis->
_prev = afterThis;
868 afterThis->
_next = addThis;
992 bool mismatch =
false;
993 if ( endTag.
Empty() ) {
1017 void XMLNode::DeleteNode(
XMLNode* node )
1022 MemPool* pool = node->_memPool;
1027 void XMLNode::InsertChildPreamble( XMLNode* insertThis )
const
1032 if ( insertThis->_parent )
1033 insertThis->_parent->Unlink( insertThis );
1035 insertThis->_memPool->SetTracked();
1041 const char* start = p;
1042 if ( this->
CData() ) {
1088 return visitor->
Visit( *
this );
1107 const char* start = p;
1137 return visitor->
Visit( *
this );
1157 const char* start = p;
1188 return visitor->
Visit( *
this );
1206 const char* start = p;
1237 return visitor->
Visit( *
this );
1252 char* XMLAttribute::ParseDeep(
char* p,
bool processEntities )
1268 if ( *p !=
'\"' && *p !=
'\'' ) {
1272 char endTag[2] = { *p, 0 };
1280 void XMLAttribute::SetName(
const char* n )
1383 XMLElement::~XMLElement()
1385 while( _rootAttribute ) {
1386 XMLAttribute* next = _rootAttribute->_next;
1388 _rootAttribute = next;
1395 for(
XMLAttribute* a = _rootAttribute; a; a = a->_next ) {
1543 XMLAttribute* XMLElement::FindOrCreateAttribute(
const char* name )
1547 for( attrib = _rootAttribute;
1549 last = attrib, attrib = attrib->_next ) {
1556 attrib =
new (
_document->_attributePool.Alloc() ) XMLAttribute();
1557 attrib->_memPool = &
_document->_attributePool;
1559 last->_next = attrib;
1562 _rootAttribute = attrib;
1564 attrib->SetName( name );
1565 attrib->_memPool->SetTracked();
1577 prev->_next = a->_next;
1580 _rootAttribute = a->_next;
1590 char* XMLElement::ParseAttributes(
char* p )
1592 const char* start = p;
1606 XMLAttribute* attrib =
new (
_document->_attributePool.Alloc() ) XMLAttribute();
1607 attrib->_memPool = &
_document->_attributePool;
1608 attrib->_memPool->SetTracked();
1611 if ( !p ||
Attribute( attrib->Name() ) ) {
1621 if ( prevAttribute ) {
1622 prevAttribute->_next = attrib;
1625 _rootAttribute = attrib;
1627 prevAttribute = attrib;
1630 else if ( *p ==
'>' ) {
1635 else if ( *p ==
'/' && *(p+1) ==
'>' ) {
1649 if ( attribute == 0 ) {
1652 MemPool* pool = attribute->_memPool;
1653 attribute->~XMLAttribute();
1654 pool->Free( attribute );
1679 p = ParseAttributes( p );
1680 if ( !p || !*p || _closingType ) {
1732 if ( visitor->
VisitEnter( *
this, _rootAttribute ) ) {
1734 if ( !node->
Accept( visitor ) ) {
1749 "XML_WRONG_ATTRIBUTE_TYPE",
1750 "XML_ERROR_FILE_NOT_FOUND",
1751 "XML_ERROR_FILE_COULD_NOT_BE_OPENED",
1752 "XML_ERROR_FILE_READ_ERROR",
1753 "XML_ERROR_ELEMENT_MISMATCH",
1754 "XML_ERROR_PARSING_ELEMENT",
1755 "XML_ERROR_PARSING_ATTRIBUTE",
1756 "XML_ERROR_IDENTIFYING_TAG",
1757 "XML_ERROR_PARSING_TEXT",
1758 "XML_ERROR_PARSING_CDATA",
1759 "XML_ERROR_PARSING_COMMENT",
1760 "XML_ERROR_PARSING_DECLARATION",
1761 "XML_ERROR_PARSING_UNKNOWN",
1762 "XML_ERROR_EMPTY_DOCUMENT",
1763 "XML_ERROR_MISMATCHED_ELEMENT",
1764 "XML_ERROR_PARSING",
1765 "XML_CAN_NOT_CONVERT_TEXT",
1773 _processEntities( processEntities ),
1775 _whitespace( whitespace ),
1796 const bool hadError =
Error();
1802 delete [] _charBuffer;
1806 _textPool.Trace(
"text" );
1807 _elementPool.Trace(
"element" );
1808 _commentPool.Trace(
"comment" );
1809 _attributePool.Trace(
"attribute" );
1814 TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() );
1815 TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );
1816 TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() );
1817 TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() );
1827 ele->_memPool = &_elementPool;
1828 ele->SetName( name );
1837 comment->_memPool = &_commentPool;
1838 comment->SetValue( str );
1847 text->_memPool = &_textPool;
1848 text->SetValue( str );
1857 dec->_memPool = &_commentPool;
1858 dec->SetValue( str ? str :
"xml version=\"1.0\" encoding=\"UTF-8\"" );
1867 unk->_memPool = &_commentPool;
1868 unk->SetValue( str );
1872 static FILE* callfopen(
const char* filepath,
const char* mode )
1876 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
1878 errno_t err = fopen_s( &fp, filepath, mode );
1883 FILE* fp = fopen( filepath, mode );
1901 XMLNode::DeleteNode(node);
1909 FILE* fp = callfopen( filename,
"rb" );
1926 <
bool = (
sizeof(
unsigned long) >=
sizeof(
size_t))>
1928 static bool Fits(
unsigned long value )
1930 return value < (size_t)-1;
1944 fseek( fp, 0, SEEK_SET );
1945 if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) {
1950 fseek( fp, 0, SEEK_END );
1951 const long filelength = ftell( fp );
1952 fseek( fp, 0, SEEK_SET );
1953 if ( filelength == -1L ) {
1965 if ( filelength == 0 ) {
1970 const size_t size = filelength;
1972 _charBuffer =
new char[size+1];
1973 size_t read = fread( _charBuffer, 1, size, fp );
1974 if ( read != size ) {
1979 _charBuffer[size] = 0;
1988 FILE* fp = callfopen( filename,
"w" );
2010 XMLError XMLDocument::Parse(
const char* p,
size_t len )
2014 if ( len == 0 || !p || !*p ) {
2018 if ( len == (
size_t)(-1) ) {
2022 _charBuffer =
new char[ len+1 ];
2023 memcpy( _charBuffer, p, len );
2024 _charBuffer[len] = 0;
2032 _elementPool.Clear();
2033 _attributePool.Clear();
2035 _commentPool.Clear();
2048 Accept( &stdoutStreamer );
2064 const char* errorName = _errorNames[_errorID];
2072 static const int LEN = 20;
2073 char buf1[LEN] = { 0 };
2074 char buf2[LEN] = { 0 };
2086 printf(
"XMLDocument error id=%d '%s' str1=%s str2=%s\n",
2087 static_cast<int>( _errorID ),
ErrorName(), buf1, buf2 );
2091 void XMLDocument::Parse()
2095 char* p = _charBuffer;
2106 _elementJustOpened(
false ),
2107 _firstElement(
true ),
2111 _processEntities(
true ),
2112 _compactMode( compact )
2114 for(
int i=0; i<ENTITY_RANGE; ++i ) {
2115 _entityFlag[i] =
false;
2116 _restrictedEntityFlag[i] =
false;
2118 for(
int i=0; i<NUM_ENTITIES; ++i ) {
2119 const char entityValue = entities[i].
value;
2120 TIXMLASSERT( 0 <= entityValue && entityValue < ENTITY_RANGE );
2121 _entityFlag[ (
unsigned char)entityValue ] =
true;
2123 _restrictedEntityFlag[(
unsigned char)
'&'] =
true;
2124 _restrictedEntityFlag[(
unsigned char)
'<'] =
true;
2125 _restrictedEntityFlag[(
unsigned char)
'>'] =
true;
2133 va_start( va, format );
2136 vfprintf( _fp, format, va );
2139 const int len = TIXML_VSCPRINTF( format, va );
2143 va_start( va, format );
2145 char* p = _buffer.
PushArr( len ) - 1;
2154 for(
int i=0; i<depth; ++i ) {
2160 void XMLPrinter::PrintString(
const char* p,
bool restricted )
2165 if ( _processEntities ) {
2166 const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag;
2170 if ( *q > 0 && *q < ENTITY_RANGE ) {
2174 if ( flag[(
unsigned char)(*q)] ) {
2176 const size_t delta = q - p;
2178 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (
int)delta;
2179 Print(
"%.*s", toPrint, p );
2182 bool entityPatternPrinted =
false;
2183 for(
int i=0; i<NUM_ENTITIES; ++i ) {
2184 if ( entities[i].value == *q ) {
2185 Print(
"&%s;", entities[i].pattern );
2186 entityPatternPrinted =
true;
2190 if ( !entityPatternPrinted ) {
2204 if ( !_processEntities || ( p < q ) ) {
2213 static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 };
2227 if ( _textDepth < 0 && !_firstElement && !compactMode ) {
2230 if ( !compactMode ) {
2234 Print(
"<%s", name );
2236 _firstElement =
false;
2244 Print(
" %s=\"", name );
2245 PrintString( value,
false );
2291 if ( _textDepth < 0 && !compactMode) {
2295 Print(
"</%s>", name );
2298 if ( _textDepth == _depth ) {
2301 if ( _depth == 0 && !compactMode) {
2320 _textDepth = _depth-1;
2324 Print(
"<![CDATA[%s]]>", text );
2327 PrintString( text,
true );
2374 if ( _textDepth < 0 && !_firstElement && !_compactMode) {
2378 _firstElement =
false;
2379 Print(
"<!--%s-->", comment );
2386 if ( _textDepth < 0 && !_firstElement && !_compactMode) {
2390 _firstElement =
false;
2391 Print(
"<?%s?>", value );
2398 if ( _textDepth < 0 && !_firstElement && !_compactMode) {
2402 _firstElement =
false;
2403 Print(
"<!%s>", value );
2420 if ( element.
Parent() ) {
2423 const bool compactMode = parentElem ?
CompactMode( *parentElem ) : _compactMode;
2425 while ( attribute ) {
2427 attribute = attribute->
Next();
void SetValue(const char *val, bool staticMem=false)
static const char * GetCharacterRef(const char *p, char *value, int *length)
bool CData() const
Returns true if this is a CDATA text element.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
virtual bool Accept(XMLVisitor *visitor) const
void SetInternedStr(const char *str)
XMLNode * InsertEndChild(XMLNode *addThis)
virtual bool Accept(XMLVisitor *visitor) const
virtual bool Accept(XMLVisitor *visitor) const
virtual void CloseElement(bool compactMode=false)
If streaming, close the Element.
static bool ToInt(const char *str, int *value)
XMLError QueryBoolText(bool *bval) const
See QueryIntText()
virtual bool Visit(const XMLText &text)
Visit a text node.
virtual bool CompactMode(const XMLElement &)
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
virtual XMLText * ToText()
Safely cast to Text, or null.
bool NoChildren() const
Returns true if this node has no children.
const char * Value() const
XMLText * NewText(const char *text)
void PushHeader(bool writeBOM, bool writeDeclaration)
XMLComment * NewComment(const char *comment)
char * ParseDeep(char *, StrPair *endTag)
virtual char * ParseDeep(char *, StrPair *)
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
void SetError(XMLError error, const char *str1, const char *str2)
virtual XMLNode * ShallowClone(XMLDocument *document) const
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
static bool ToUnsigned(const char *str, unsigned *value)
virtual void SetTracked()=0
const char * ErrorName() const
static void ToStr(int v, char *buffer, int bufferSize)
const char * Name() const
Get the name of an element (which is the Value() of the node.)
static const char * ReadBOM(const char *p, bool *hasBOM)
XMLUnknown(XMLDocument *doc)
static const char * SkipWhiteSpace(const char *p)
char * ParseText(char *in, const char *endTag, int strFlags)
XMLError QueryIntValue(int *value) const
void OpenElement(const char *name, bool compactMode=false)
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
static bool IsNameChar(unsigned char ch)
bool ProcessEntities() const
void DeleteNode(XMLNode *node)
const char * Attribute(const char *name, const char *value=0) const
virtual bool Accept(XMLVisitor *visitor) const
virtual bool ShallowEqual(const XMLNode *compare) const
virtual XMLNode * ShallowClone(XMLDocument *document) const
void DeleteChild(XMLNode *node)
void PushComment(const char *comment)
Add a comment.
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
virtual void PrintSpace(int depth)
DynArray< const char *, 10 > _stack
XMLError QueryUnsignedText(unsigned *uval) const
See QueryIntText()
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
char * Identify(char *p, XMLNode **node)
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
const XMLElement * NextSiblingElement(const char *name=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
void Set(char *start, char *end, int flags)
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
char * ParseDeep(char *p, StrPair *endTag)
virtual bool Accept(XMLVisitor *visitor) const
virtual bool VisitExit(const XMLDocument &)
Visit a document.
char * ParseName(char *in)
const XMLElement * PreviousSiblingElement(const char *name=0) const
Get the previous (left) sibling element of this node, with an optionally supplied name...
virtual bool ShallowEqual(const XMLNode *compare) const
static bool ToFloat(const char *str, float *value)
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
virtual ~XMLDeclaration()
void PushText(const char *text, bool cdata=false)
Add a text node.
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
static bool Fits(unsigned long value)
void SealElementIfJustOpened()
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
static bool ToDouble(const char *str, double *value)
const char * Value() const
The value of the attribute.
virtual XMLNode * ShallowClone(XMLDocument *document) const
XMLElement * NewElement(const char *name)
const char * GetText() const
void PushUnknown(const char *value)
XMLError QueryDoubleText(double *dval) const
See QueryIntText()
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.
static bool IsWhiteSpace(char p)
XMLError SaveFile(const char *filename, bool compact=false)
virtual XMLNode * ShallowClone(XMLDocument *document) const
char * ParseDeep(char *, StrPair *endTag)
XMLError QueryFloatText(float *fval) const
See QueryIntText()
XMLError QueryIntText(int *ival) const
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
void TransferTo(StrPair *other)
void Clear()
Clear the document, resetting it to the initial state.
virtual bool Accept(XMLVisitor *visitor) const =0
const XMLAttribute * Next() const
The next attribute in the list.
static bool IsNameStartChar(unsigned char ch)
void Print(XMLPrinter *streamer=0) const
const XMLElement * LastChildElement(const char *name=0) const
XMLDeclaration * NewDeclaration(const char *text=0)
XMLError LoadFile(const char *filename)
XMLUnknown * NewUnknown(const char *text)
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
Whitespace WhitespaceMode() const
bool Error() const
Return true if there was an error parsing the document.
XMLError Parse(const char *xml, size_t nBytes=(size_t)(-1))
const XMLElement * FirstChildElement(const char *name=0) const
XMLDeclaration(XMLDocument *doc)
void PrintError() const
If there is an error, print it to stdout.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
void Print(const char *format,...)
XMLNode * InsertAfterChild(XMLNode *afterThis, XMLNode *addThis)
void DeleteAttribute(const char *name)
static bool ToBool(const char *str, bool *value)
XMLPrinter(FILE *file=0, bool compact=false, int depth=0)
void SetText(const char *inText)
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
void PushDeclaration(const char *value)
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
const char * Name() const
The name of the attribute.
const XMLAttribute * FindAttribute(const char *name) const
Query a specific attribute in the list.
void SetStr(const char *str, int flags=0)
char * ParseDeep(char *, StrPair *endTag)
virtual bool ShallowEqual(const XMLNode *compare) const
XMLDocument(bool processEntities=true, Whitespace=PRESERVE_WHITESPACE)
constructor
XMLNode * InsertFirstChild(XMLNode *addThis)
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
virtual bool ShallowEqual(const XMLNode *compare) const