Go to the documentation of this file.
27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
35 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
47 va_start( va, format );
48 const int result = vsnprintf_s(
buffer,
size, _TRUNCATE, format, va );
55 const 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.
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
96 int len = vsnprintf( 0, 0, format, va );
100 #define TIXML_SSCANF sscanf
104 #define TIXML_FSEEK _fseeki64
105 #define TIXML_FTELL _ftelli64
106 #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__CYGWIN__)
107 #define TIXML_FSEEK fseeko
108 #define TIXML_FTELL ftello
109 #elif defined(__ANDROID__)
110 #if __ANDROID_API__ > 24
111 #define TIXML_FSEEK fseeko64
112 #define TIXML_FTELL ftello64
114 #define TIXML_FSEEK fseeko
115 #define TIXML_FTELL ftello
118 #define TIXML_FSEEK fseek
119 #define TIXML_FTELL ftell
165 if (
this == other ) {
203 size_t len = strlen( str );
205 _start =
new char[ len+1 ];
206 memcpy(
_start, str, len+1 );
219 const char endChar = *endTag;
220 size_t length = strlen( endTag );
224 if ( *
p == endChar && strncmp(
p, endTag, length ) == 0 ) {
225 Set( start,
p, strFlags );
227 }
else if (*
p ==
'\n') {
246 char*
const start =
p;
303 if ( *(
p+1) ==
LF ) {
313 if ( *(
p+1) ==
CR ) {
328 if ( *(
p+1) ==
'#' ) {
329 const int buflen = 10;
330 char buf[buflen] = { 0 };
333 if ( adjusted == 0 ) {
342 memcpy( q, buf, len );
347 bool entityFound =
false;
351 && *(
p + entity.
length + 1 ) ==
';' ) {
360 if ( !entityFound ) {
396 static const char* defTrue =
"true";
397 static const char* defFalse =
"false";
409 const unsigned char* pu =
reinterpret_cast<const unsigned char*
>(
p);
424 const unsigned long BYTE_MASK = 0xBF;
425 const unsigned long BYTE_MARK = 0x80;
426 const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
431 else if ( input < 0x800 ) {
434 else if ( input < 0x10000 ) {
437 else if ( input < 0x200000 ) {
452 *output =
static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
457 *output =
static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
462 *output =
static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
467 *output =
static_cast<char>(input | FIRST_BYTE_MARK[*length]);
480 if ( *(
p+1) ==
'#' && *(
p+2) ) {
481 unsigned long ucs = 0;
485 static const char SEMICOLON =
';';
487 if ( *(
p+2) ==
'x' ) {
494 q = strchr( q, SEMICOLON );
504 while ( *q !=
'x' ) {
505 unsigned int digit = 0;
507 if ( *q >=
'0' && *q <=
'9' ) {
510 else if ( *q >=
'a' && *q <=
'f' ) {
511 digit = *q -
'a' + 10;
513 else if ( *q >=
'A' && *q <=
'F' ) {
514 digit = *q -
'A' + 10;
521 const unsigned int digitScaled = mult *
digit;
536 q = strchr( q, SEMICOLON );
546 while ( *q !=
'#' ) {
547 if ( *q >=
'0' && *q <=
'9' ) {
548 const unsigned int digit = *q -
'0';
551 const unsigned int digitScaled = mult *
digit;
565 return p + delta + 1;
621 *value =
static_cast<int>(v);
644 if (
ToInt( str, &ival )) {
645 *value = (ival==0) ?
false :
true;
648 static const char* TRUE_VALS[] = {
"true",
"True",
"TRUE", 0 };
649 static const char* FALSE_VALS[] = {
"false",
"False",
"FALSE", 0 };
651 for (
int i = 0; TRUE_VALS[i]; ++i) {
657 for (
int i = 0; FALSE_VALS[i]; ++i) {
688 unsigned long long v = 0;
690 *value =
static_cast<int64_t
>(v);
697 *value =
static_cast<int64_t
>(v);
706 unsigned long long v = 0;
708 *value = (uint64_t)v;
719 char*
const start =
p;
729 static const char* xmlHeader = {
"<?" };
730 static const char* commentHeader = {
"<!--" };
731 static const char* cdataHeader = {
"<![CDATA[" };
732 static const char* dtdHeader = {
"<!" };
733 static const char* elementHeader = {
"<" };
735 static const int xmlHeaderLen = 2;
736 static const int commentHeaderLen = 4;
737 static const int cdataHeaderLen = 9;
738 static const int dtdHeaderLen = 2;
739 static const int elementHeaderLen = 1;
745 returnNode = CreateUnlinkedNode<XMLDeclaration>(
_commentPool );
750 returnNode = CreateUnlinkedNode<XMLComment>(
_commentPool );
752 p += commentHeaderLen;
762 returnNode = CreateUnlinkedNode<XMLUnknown>(
_commentPool );
770 returnNode = CreateUnlinkedNode<XMLText>(
_textPool);
776 returnNode = CreateUnlinkedNode<XMLElement>(
_elementPool);
778 p += elementHeaderLen;
782 returnNode = CreateUnlinkedNode<XMLText>(
_textPool );
800 if ( !node->Accept( visitor ) ) {
816 _firstChild( 0 ), _lastChild( 0 ),
817 _prev( 0 ), _next( 0 ),
881 if (!clone)
return 0;
913 if (
child->_prev ) {
916 if (
child->_next ) {
1009 if ( afterThis->
_parent !=
this ) {
1013 if ( afterThis == addThis ) {
1021 if ( afterThis->
_next == 0 ) {
1026 addThis->
_prev = afterThis;
1029 afterThis->
_next = addThis;
1141 bool wellLocated =
false;
1155 if ( !wellLocated ) {
1166 if ( parentEndTag ) {
1176 bool mismatch =
false;
1177 if ( endTag.
Empty() ) {
1233 if ( element == 0 ) {
1248 if ( this->
CData() ) {
1295 return visitor->
Visit( *
this );
1343 return visitor->
Visit( *
this );
1393 return visitor->
Visit( *
this );
1440 return visitor->
Visit( *
this );
1471 if ( *
p !=
'\"' && *
p !=
'\'' ) {
1475 const char endTag[2] = { *
p, 0 };
1613 _closingType( OPEN ),
1654 int i = defaultValue;
1661 unsigned i = defaultValue;
1668 int64_t i = defaultValue;
1675 uint64_t i = defaultValue;
1682 bool b = defaultValue;
1689 double d = defaultValue;
1696 float f = defaultValue;
1713 if ( node && node->
ToText() ) {
1714 return node->
Value();
1877 int i = defaultValue;
1884 unsigned i = defaultValue;
1891 int64_t i = defaultValue;
1898 uint64_t i = defaultValue;
1905 bool b = defaultValue;
1912 double d = defaultValue;
1919 float f = defaultValue;
1931 last = attrib, attrib = attrib->
_next ) {
1941 last->
_next = attrib;
1959 prev->_next = a->_next;
2003 if ( prevAttribute ) {
2005 prevAttribute->
_next = attrib;
2011 prevAttribute = attrib;
2014 else if ( *
p ==
'>' ) {
2019 else if ( *
p ==
'/' && *(
p+1) ==
'>' ) {
2033 if ( attribute == 0 ) {
2038 pool->
Free( attribute );
2161 if ( !node->Accept( visitor ) ) {
2176 "XML_WRONG_ATTRIBUTE_TYPE",
2177 "XML_ERROR_FILE_NOT_FOUND",
2178 "XML_ERROR_FILE_COULD_NOT_BE_OPENED",
2179 "XML_ERROR_FILE_READ_ERROR",
2180 "XML_ERROR_PARSING_ELEMENT",
2181 "XML_ERROR_PARSING_ATTRIBUTE",
2182 "XML_ERROR_PARSING_TEXT",
2183 "XML_ERROR_PARSING_CDATA",
2184 "XML_ERROR_PARSING_COMMENT",
2185 "XML_ERROR_PARSING_DECLARATION",
2186 "XML_ERROR_PARSING_UNKNOWN",
2187 "XML_ERROR_EMPTY_DOCUMENT",
2188 "XML_ERROR_MISMATCHED_ELEMENT",
2189 "XML_ERROR_PARSING",
2190 "XML_CAN_NOT_CONVERT_TEXT",
2192 "XML_ELEMENT_DEPTH_EXCEEDED"
2199 _processEntities( processEntities ),
2201 _whitespaceMode( whitespaceMode ),
2205 _parseCurLineNum( 0 ),
2229 for (
int i = 0; i <
_unlinked.Size(); ++i) {
2244 #ifdef TINYXML2_DEBUG
2245 const bool hadError =
Error();
2260 #ifdef TINYXML2_DEBUG
2274 if (target ==
this) {
2311 dec->
SetValue( str ? str :
"xml version=\"1.0\" encoding=\"UTF-8\"" );
2323 static FILE*
callfopen(
const char* filepath,
const char* mode )
2327 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
2329 const errno_t err = fopen_s( &fp, filepath, mode );
2334 FILE* fp = fopen( filepath, mode );
2381 if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) {
2388 unsigned long long filelength;
2390 const long long fileLengthSigned =
TIXML_FTELL( fp );
2392 if ( fileLengthSigned == -1L ) {
2397 filelength =
static_cast<unsigned long long>(fileLengthSigned);
2400 const size_t maxSizeT =
static_cast<size_t>(-1);
2403 if ( filelength >=
static_cast<unsigned long long>(maxSizeT) ) {
2409 if ( filelength == 0 ) {
2414 const size_t size =
static_cast<size_t>(filelength);
2418 if ( read !=
size ) {
2464 if ( nBytes == 0 || !xml || !*xml ) {
2468 if ( nBytes ==
static_cast<size_t>(-1) ) {
2469 nBytes = strlen( xml );
2498 Accept( &stdoutStreamer );
2517 const size_t BUFFER_SIZE = 1000;
2518 char*
buffer =
new char[BUFFER_SIZE];
2524 size_t len = strlen(
buffer);
2529 va_start(va, format);
2593 _elementJustOpened( false ),
2595 _firstElement( true ),
2599 _processEntities( true ),
2600 _compactMode( compact ),
2609 const unsigned char flagIndex =
static_cast<unsigned char>(entityValue);
2623 va_start( va, format );
2626 vfprintf(
_fp, format, va );
2633 va_start( va, format );
2645 fwrite ( data ,
sizeof(
char),
size,
_fp);
2649 memcpy(
p, data,
size );
2670 for(
int i=0; i<depth; ++i ) {
2690 if (
flag[
static_cast<unsigned char>(*q)] ) {
2692 const size_t delta = q -
p;
2693 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2697 bool entityPatternPrinted =
false;
2703 entityPatternPrinted =
true;
2707 if ( !entityPatternPrinted ) {
2720 const size_t delta = q -
p;
2721 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2735 Write(
reinterpret_cast< const char*
>( bom ) );
2746 if ( compactMode ) {
2853 if (
_depth == 0 && !compactMode) {
2876 Write(
"<![CDATA[" );
2985 if ( element.
Parent() ) {
2990 while ( attribute ) {
2992 attribute = attribute->
Next();
void DeepCopy(XMLDocument *target) const
constexpr auto size(const C &c) -> decltype(c.size())
virtual bool ShallowEqual(const XMLNode *compare) const override
virtual void SetTracked()=0
XMLError QueryDoubleText(double *dval) const
See QueryIntText()
virtual void Putc(char ch)
XMLUnknown * InsertNewUnknown(const char *text)
See InsertNewChildElement()
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
static const unsigned char TIXML_UTF_LEAD_0
void ClearError()
Clears the error flags.
XMLUnknown(XMLDocument *doc)
XMLError QueryUnsigned64Attribute(const char *name, uint64_t *value) const
See QueryIntAttribute()
static int TIXML_VSCPRINTF(const char *format, va_list va)
unsigned UnsignedText(unsigned defaultValue=0) const
See QueryIntText()
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
bool Error() const
Return true if there was an error parsing the document.
double DoubleAttribute(const char *name, double defaultValue=0) const
See IntAttribute()
virtual void Write(const char *data, size_t size)
const char * Value() const
The value of the attribute.
XMLNode * InsertFirstChild(XMLNode *addThis)
int64_t Int64Attribute(const char *name, int64_t defaultValue=0) const
See IntAttribute()
const char * Attribute(const char *name, const char *value=0) const
bool CData() const
Returns true if this is a CDATA text element.
virtual bool Accept(XMLVisitor *visitor) const override
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
char * ParseText(char *in, const char *endTag, int strFlags, int *curLineNumPtr)
static bool ToUnsigned(const char *str, unsigned *value)
XMLAttribute * _rootAttribute
DynArray< const char *, 10 > _stack
static const char * ErrorIDToName(XMLError errorID)
const char * Value() const
virtual ~XMLDeclaration()
void SetAttribute(const char *value)
Set the attribute to a string value.
void DeleteAttribute(const char *name)
virtual bool VisitExit(const XMLDocument &)
Visit a document.
char * ParseAttributes(char *p, int *curLineNumPtr)
void PrintString(const char *, bool restrictedEntitySet)
void OpenElement(const char *name, bool compactMode=false)
int IntAttribute(const char *name, int defaultValue=0) const
@ XML_ERROR_PARSING_UNKNOWN
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
XMLNode * DeepClone(XMLDocument *target) const
bool NoChildren() const
Returns true if this node has no children.
XMLUnknown * NewUnknown(const char *text)
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
@ XML_ERROR_FILE_NOT_FOUND
static const char * ReadBOM(const char *p, bool *hasBOM)
@ XML_ERROR_FILE_COULD_NOT_BE_OPENED
@ XML_WRONG_ATTRIBUTE_TYPE
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
static bool ToUnsigned64(const char *str, uint64_t *value)
virtual bool ShallowEqual(const XMLNode *compare) const override
virtual bool VisitExit(const XMLDocument &) override
Visit a document.
@ NEEDS_WHITESPACE_COLLAPSING
static const char CARRIAGE_RETURN
XMLError LoadFile(const char *filename)
XMLText * InsertNewText(const char *text)
See InsertNewChildElement()
@ XML_ERROR_PARSING_DECLARATION
const XMLElement * PreviousSiblingElement(const char *name=0) const
Get the previous (left) sibling element of this node, with an optionally supplied name.
@ XML_ERROR_FILE_READ_ERROR
const XMLElement * NextSiblingElement(const char *name=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
@ ATTRIBUTE_VALUE_LEAVE_ENTITIES
static const unsigned char TIXML_UTF_LEAD_2
@ XML_ERROR_PARSING_ELEMENT
char * ParseName(char *in)
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
static bool ToInt(const char *str, int *value)
Whitespace WhitespaceMode() const
static void DeleteNode(XMLNode *node)
@ NEEDS_NEWLINE_NORMALIZATION
void Unlink(XMLNode *child)
static FILE * callfopen(const char *filepath, const char *mode)
XMLAttribute * FindOrCreateAttribute(const char *name)
XMLNode * InsertAfterChild(XMLNode *afterThis, XMLNode *addThis)
XMLElement * NewElement(const char *name)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
XMLAttribute * CreateAttribute()
virtual XMLNode * ShallowClone(XMLDocument *document) const override
void MarkInUse(const XMLNode *const)
DynArray< char, 20 > _buffer
XMLError QueryIntText(int *ival) const
virtual bool ShallowEqual(const XMLNode *compare) const override
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
static const int TINYXML2_MAX_ELEMENT_DEPTH
void DeleteChild(XMLNode *node)
MemPoolT< sizeof(XMLElement) > _elementPool
virtual XMLNode * ShallowClone(XMLDocument *document) const override
const char * GetText() const
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
XMLError QueryUnsigned64Text(uint64_t *uval) const
See QueryIntText()
@ XML_ERROR_PARSING_COMMENT
virtual bool Accept(XMLVisitor *visitor) const override
XMLError SaveFile(const char *filename, bool compact=false)
void Set(char *start, char *end, int flags)
static const unsigned char TIXML_UTF_LEAD_1
virtual void PrintSpace(int depth)
bool ProcessEntities() const
char * ParseDeep(char *p, bool processEntities, int *curLineNumPtr)
void PrintError() const
A (trivial) utility function that prints the ErrorStr() to stdout.
void PrepareForNewNode(bool compactMode)
static const char * GetCharacterRef(const char *p, char *value, int *length)
XMLDeclaration(XMLDocument *doc)
ElementClosingType _closingType
static const char * writeBoolTrue
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
virtual bool ShallowEqual(const XMLNode *compare) const override
bool _entityFlag[ENTITY_RANGE]
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
constexpr auto count
Sink that counts all arguments.
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
@ TEXT_ELEMENT_LEAVE_ENTITIES
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
static bool IsNameStartChar(unsigned char ch)
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
XMLElement * InsertNewChildElement(const char *name)
unsigned UnsignedAttribute(const char *name, unsigned defaultValue=0) const
See IntAttribute()
float FloatText(float defaultValue=0) const
See QueryIntText()
virtual void CloseElement(bool compactMode=false)
If streaming, close the Element.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
DynArray< XMLNode *, 10 > _unlinked
bool BoolText(bool defaultValue=false) const
See QueryIntText()
void Clear()
Clear the document, resetting it to the initial state.
int IntText(int defaultValue=0) const
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
static const char * writeBoolFalse
void SetError(XMLError error, int lineNum, const char *format,...)
const XMLAttribute * FindAttribute(const char *name) const
Query a specific attribute in the list.
buffer(const CharT *, const CharT *) -> buffer< deduce_encoding< CharT >>
void SetInternedStr(const char *str)
const char * ErrorStr() const
XMLError QueryInt64Text(int64_t *uval) const
See QueryIntText()
auto child(const lexy::parse_tree< Reader, TokenKind, MemoryResource > &tree, typename lexy::parse_tree< Reader, TokenKind, MemoryResource >::node node, Predicate predicate) -> std::optional< typename lexy::parse_tree< Reader, TokenKind, MemoryResource >::node >
Returns the first child that matches predicate, if there is any.
static const char SINGLE_QUOTE
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
XMLError QueryBoolText(bool *bval) const
See QueryIntText()
ElementClosingType ClosingType() const
void TransferTo(StrPair *other)
const XMLNode * Parent() const
Get the parent of this node on the DOM.
virtual bool Accept(XMLVisitor *visitor) const override
@ XML_ERROR_PARSING_CDATA
virtual bool CompactMode(const XMLElement &)
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
char * Identify(char *p, XMLNode **node, bool first)
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
uint64_t Unsigned64Attribute(const char *name, uint64_t defaultValue=0) const
See IntAttribute()
constexpr auto n() noexcept
void SetStr(const char *str, int flags=0)
const XMLElement * ToElementWithName(const char *name) const
MemPoolT< sizeof(XMLAttribute) > _attributePool
int64_t Int64Text(int64_t defaultValue=0) const
See QueryIntText()
static bool IsPrefixHex(const char *p)
void PushDeclaration(const char *value)
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
virtual bool Accept(XMLVisitor *visitor) const override
@ XML_ERROR_PARSING_ATTRIBUTE
void InsertChildPreamble(XMLNode *insertThis) const
void Print(XMLPrinter *streamer=0) const
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
void PushComment(const char *comment)
Add a comment.
static bool ToFloat(const char *str, float *value)
XMLError QueryUnsigned64Value(uint64_t *value) const
See QueryIntValue.
static const char DOUBLE_QUOTE
static bool ToBool(const char *str, bool *value)
const char * ErrorName() const
XMLDeclaration * InsertNewDeclaration(const char *text)
See InsertNewChildElement()
static void ToStr(int v, char *buffer, int bufferSize)
void SetValue(const char *val, bool staticMem=false)
static bool ToDouble(const char *str, double *value)
const XMLElement * LastChildElement(const char *name=0) const
static const int NUM_ENTITIES
virtual void Free(void *)=0
void SetName(const char *name)
virtual void Print(const char *format,...)
bool BoolAttribute(const char *name, bool defaultValue=false) const
See IntAttribute()
static bool IsWhiteSpace(char p)
void PushUnknown(const char *value)
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLError QueryIntAttribute(const char *name, int *value) const
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
XMLPrinter(FILE *file=0, bool compact=false, int depth=0)
uint64_t Unsigned64Text(uint64_t defaultValue=0) const
See QueryIntText()
static bool ToInt64(const char *str, int64_t *value)
@ XML_CAN_NOT_CONVERT_TEXT
virtual XMLNode * ShallowClone(XMLDocument *document) const override
@ XML_ELEMENT_DEPTH_EXCEEDED
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
static void SetBoolSerialization(const char *writeTrue, const char *writeFalse)
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
const char * Name() const
The name of the attribute.
virtual bool Visit(const XMLText &text) override
Visit a text node.
static const Entity entities[NUM_ENTITIES]
XMLError QueryFloatText(float *fval) const
See QueryIntText()
int ChildElementCount() const
MemPoolT< sizeof(XMLComment) > _commentPool
@ NEEDS_ENTITY_PROCESSING
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
static const char LINE_FEED
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
void SealElementIfJustOpened()
@ XML_ERROR_MISMATCHED_ELEMENT
XMLNode * InsertEndChild(XMLNode *addThis)
XMLText * NewText(const char *text)
void CollapseWhitespace()
void DeleteNode(XMLNode *node)
static bool IsNameChar(unsigned char ch)
static const char * _errorNames[XML_ERROR_COUNT]
XMLComment * InsertNewComment(const char *comment)
See InsertNewChildElement()
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
constexpr auto flag(Rule)
void PushHeader(bool writeBOM, bool writeDeclaration)
XMLDeclaration * NewDeclaration(const char *text=0)
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
constexpr auto p
Parses the production.
double DoubleText(double defaultValue=0) const
See QueryIntText()
virtual char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
bool _restrictedEntityFlag[ENTITY_RANGE]
@ XML_ERROR_EMPTY_DOCUMENT
XMLError QueryUnsignedText(unsigned *uval) const
See QueryIntText()
MemPoolT< sizeof(XMLText) > _textPool
XMLComment * NewComment(const char *comment)
virtual bool VisitEnter(const XMLDocument &) override
Visit a document.
void PushText(const char *text, bool cdata=false)
Add a text node.
XMLError QueryIntValue(int *value) const
virtual bool Accept(XMLVisitor *visitor) const override
const XMLElement * FirstChildElement(const char *name=0) const
const XMLAttribute * Next() const
The next attribute in the list.
float FloatAttribute(const char *name, float defaultValue=0) const
See IntAttribute()
const char * Name() const
Get the name of an element (which is the Value() of the node.)
void SetText(const char *inText)