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(__ANDROID__)
107 #define TIXML_FSEEK fseeko
108 #define TIXML_FTELL ftello
109 #elif defined(__unix__) && defined(__x86_64__)
110 #define TIXML_FSEEK fseeko64
111 #define TIXML_FTELL ftello64
113 #define TIXML_FSEEK fseek
114 #define TIXML_FTELL ftell
160 if (
this == other ) {
198 size_t len = strlen( str );
200 _start =
new char[ len+1 ];
201 memcpy(
_start, str, len+1 );
214 const char endChar = *endTag;
215 size_t length = strlen( endTag );
219 if ( *
p == endChar && strncmp(
p, endTag, length ) == 0 ) {
220 Set( start,
p, strFlags );
222 }
else if (*
p ==
'\n') {
241 char*
const start =
p;
298 if ( *(
p+1) ==
LF ) {
308 if ( *(
p+1) ==
CR ) {
323 if ( *(
p+1) ==
'#' ) {
324 const int buflen = 10;
325 char buf[buflen] = { 0 };
328 if ( adjusted == 0 ) {
337 memcpy( q, buf, len );
342 bool entityFound =
false;
346 && *(
p + entity.
length + 1 ) ==
';' ) {
355 if ( !entityFound ) {
391 static const char* defTrue =
"true";
392 static const char* defFalse =
"false";
404 const unsigned char* pu =
reinterpret_cast<const unsigned char*
>(
p);
419 const unsigned long BYTE_MASK = 0xBF;
420 const unsigned long BYTE_MARK = 0x80;
421 const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
426 else if ( input < 0x800 ) {
429 else if ( input < 0x10000 ) {
432 else if ( input < 0x200000 ) {
447 *output =
static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
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 | FIRST_BYTE_MARK[*length]);
475 if ( *(
p+1) ==
'#' && *(
p+2) ) {
476 unsigned long ucs = 0;
480 static const char SEMICOLON =
';';
482 if ( *(
p+2) ==
'x' ) {
489 q = strchr( q, SEMICOLON );
499 while ( *q !=
'x' ) {
500 unsigned int digit = 0;
502 if ( *q >=
'0' && *q <=
'9' ) {
505 else if ( *q >=
'a' && *q <=
'f' ) {
506 digit = *q -
'a' + 10;
508 else if ( *q >=
'A' && *q <=
'F' ) {
509 digit = *q -
'A' + 10;
516 const unsigned int digitScaled = mult *
digit;
531 q = strchr( q, SEMICOLON );
541 while ( *q !=
'#' ) {
542 if ( *q >=
'0' && *q <=
'9' ) {
543 const unsigned int digit = *q -
'0';
546 const unsigned int digitScaled = mult *
digit;
560 return p + delta + 1;
616 *value =
static_cast<int>(v);
639 if (
ToInt( str, &ival )) {
640 *value = (ival==0) ?
false :
true;
643 static const char* TRUE_VALS[] = {
"true",
"True",
"TRUE", 0 };
644 static const char* FALSE_VALS[] = {
"false",
"False",
"FALSE", 0 };
646 for (
int i = 0; TRUE_VALS[i]; ++i) {
652 for (
int i = 0; FALSE_VALS[i]; ++i) {
683 unsigned long long v = 0;
685 *value =
static_cast<int64_t
>(v);
692 *value =
static_cast<int64_t
>(v);
701 unsigned long long v = 0;
703 *value = (uint64_t)v;
714 char*
const start =
p;
724 static const char* xmlHeader = {
"<?" };
725 static const char* commentHeader = {
"<!--" };
726 static const char* cdataHeader = {
"<![CDATA[" };
727 static const char* dtdHeader = {
"<!" };
728 static const char* elementHeader = {
"<" };
730 static const int xmlHeaderLen = 2;
731 static const int commentHeaderLen = 4;
732 static const int cdataHeaderLen = 9;
733 static const int dtdHeaderLen = 2;
734 static const int elementHeaderLen = 1;
740 returnNode = CreateUnlinkedNode<XMLDeclaration>(
_commentPool );
745 returnNode = CreateUnlinkedNode<XMLComment>(
_commentPool );
747 p += commentHeaderLen;
757 returnNode = CreateUnlinkedNode<XMLUnknown>(
_commentPool );
762 returnNode = CreateUnlinkedNode<XMLElement>(
_elementPool );
764 p += elementHeaderLen;
767 returnNode = CreateUnlinkedNode<XMLText>(
_textPool );
785 if ( !node->Accept( visitor ) ) {
801 _firstChild( 0 ), _lastChild( 0 ),
802 _prev( 0 ), _next( 0 ),
838 if (!clone)
return 0;
870 if (
child->_prev ) {
873 if (
child->_next ) {
966 if ( afterThis->
_parent !=
this ) {
970 if ( afterThis == addThis ) {
978 if ( afterThis->
_next == 0 ) {
983 addThis->
_prev = afterThis;
986 afterThis->
_next = addThis;
1096 bool wellLocated =
false;
1110 if ( !wellLocated ) {
1121 if ( parentEndTag ) {
1131 bool mismatch =
false;
1132 if ( endTag.
Empty() ) {
1188 if ( element == 0 ) {
1203 if ( this->
CData() ) {
1250 return visitor->
Visit( *
this );
1298 return visitor->
Visit( *
this );
1348 return visitor->
Visit( *
this );
1395 return visitor->
Visit( *
this );
1426 if ( *
p !=
'\"' && *
p !=
'\'' ) {
1430 const char endTag[2] = { *
p, 0 };
1568 _closingType( OPEN ),
1609 int i = defaultValue;
1616 unsigned i = defaultValue;
1623 int64_t i = defaultValue;
1630 uint64_t i = defaultValue;
1637 bool b = defaultValue;
1644 double d = defaultValue;
1651 float f = defaultValue;
1668 if ( node && node->
ToText() ) {
1669 return node->
Value();
1832 int i = defaultValue;
1839 unsigned i = defaultValue;
1846 int64_t i = defaultValue;
1853 uint64_t i = defaultValue;
1860 bool b = defaultValue;
1867 double d = defaultValue;
1874 float f = defaultValue;
1886 last = attrib, attrib = attrib->
_next ) {
1896 last->
_next = attrib;
1914 prev->_next = a->_next;
1958 if ( prevAttribute ) {
1960 prevAttribute->
_next = attrib;
1966 prevAttribute = attrib;
1969 else if ( *
p ==
'>' ) {
1974 else if ( *
p ==
'/' && *(
p+1) ==
'>' ) {
1988 if ( attribute == 0 ) {
1993 pool->
Free( attribute );
2116 if ( !node->Accept( visitor ) ) {
2131 "XML_WRONG_ATTRIBUTE_TYPE",
2132 "XML_ERROR_FILE_NOT_FOUND",
2133 "XML_ERROR_FILE_COULD_NOT_BE_OPENED",
2134 "XML_ERROR_FILE_READ_ERROR",
2135 "XML_ERROR_PARSING_ELEMENT",
2136 "XML_ERROR_PARSING_ATTRIBUTE",
2137 "XML_ERROR_PARSING_TEXT",
2138 "XML_ERROR_PARSING_CDATA",
2139 "XML_ERROR_PARSING_COMMENT",
2140 "XML_ERROR_PARSING_DECLARATION",
2141 "XML_ERROR_PARSING_UNKNOWN",
2142 "XML_ERROR_EMPTY_DOCUMENT",
2143 "XML_ERROR_MISMATCHED_ELEMENT",
2144 "XML_ERROR_PARSING",
2145 "XML_CAN_NOT_CONVERT_TEXT",
2147 "XML_ELEMENT_DEPTH_EXCEEDED"
2154 _processEntities( processEntities ),
2156 _whitespaceMode( whitespaceMode ),
2160 _parseCurLineNum( 0 ),
2184 for (
int i = 0; i <
_unlinked.Size(); ++i) {
2199 #ifdef TINYXML2_DEBUG
2200 const bool hadError =
Error();
2215 #ifdef TINYXML2_DEBUG
2229 if (target ==
this) {
2266 dec->
SetValue( str ? str :
"xml version=\"1.0\" encoding=\"UTF-8\"" );
2278 static FILE*
callfopen(
const char* filepath,
const char* mode )
2282 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
2284 const errno_t err = fopen_s( &fp, filepath, mode );
2289 FILE* fp = fopen( filepath, mode );
2336 if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) {
2343 unsigned long long filelength;
2345 const long long fileLengthSigned =
TIXML_FTELL( fp );
2347 if ( fileLengthSigned == -1L ) {
2352 filelength =
static_cast<unsigned long long>(fileLengthSigned);
2355 const size_t maxSizeT =
static_cast<size_t>(-1);
2358 if ( filelength >=
static_cast<unsigned long long>(maxSizeT) ) {
2364 if ( filelength == 0 ) {
2369 const size_t size =
static_cast<size_t>(filelength);
2373 if ( read !=
size ) {
2419 if ( len == 0 || !
p || !*
p ) {
2423 if ( len ==
static_cast<size_t>(-1) ) {
2453 Accept( &stdoutStreamer );
2472 const size_t BUFFER_SIZE = 1000;
2473 char*
buffer =
new char[BUFFER_SIZE];
2479 size_t len = strlen(
buffer);
2484 va_start(va, format);
2548 _elementJustOpened( false ),
2550 _firstElement( true ),
2554 _processEntities( true ),
2555 _compactMode( compact ),
2564 const unsigned char flagIndex =
static_cast<unsigned char>(entityValue);
2578 va_start( va, format );
2581 vfprintf(
_fp, format, va );
2588 va_start( va, format );
2600 fwrite ( data ,
sizeof(
char),
size,
_fp);
2604 memcpy(
p, data,
size );
2625 for(
int i=0; i<depth; ++i ) {
2645 if (
flag[
static_cast<unsigned char>(*q)] ) {
2647 const size_t delta = q -
p;
2648 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2652 bool entityPatternPrinted =
false;
2658 entityPatternPrinted =
true;
2662 if ( !entityPatternPrinted ) {
2675 const size_t delta = q -
p;
2676 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2690 Write(
reinterpret_cast< const char*
>( bom ) );
2701 if ( compactMode ) {
2808 if (
_depth == 0 && !compactMode) {
2831 Write(
"<![CDATA[" );
2940 if ( element.
Parent() ) {
2945 while ( attribute ) {
2947 attribute = attribute->
Next();
void DeepCopy(XMLDocument *target) const
constexpr auto size(const C &c) -> decltype(c.size())
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)
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
unsigned UnsignedText(unsigned defaultValue=0) const
See QueryIntText()
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)
virtual bool ShallowEqual(const XMLNode *compare) const
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 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()
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
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)
@ NEEDS_WHITESPACE_COLLAPSING
static const char CARRIAGE_RETURN
XMLError LoadFile(const char *filename)
virtual XMLNode * ShallowClone(XMLDocument *document) const
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
virtual bool VisitExit(const XMLDocument &)
Visit a document.
void Unlink(XMLNode *child)
static FILE * callfopen(const char *filepath, const char *mode)
XMLAttribute * FindOrCreateAttribute(const char *name)
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
XMLNode * InsertAfterChild(XMLNode *afterThis, XMLNode *addThis)
XMLElement * NewElement(const char *name)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
XMLAttribute * CreateAttribute()
void MarkInUse(const XMLNode *const)
DynArray< char, 20 > _buffer
XMLError QueryIntText(int *ival) const
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
const char * GetText() const
char * Identify(char *p, XMLNode **node)
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 VisitEnter(const XMLDocument &)
Visit a document.
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.
bool _entityFlag[ENTITY_RANGE]
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
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.
virtual bool ShallowEqual(const XMLNode *compare) const
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
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.
@ XML_ERROR_PARSING_CDATA
virtual bool Accept(XMLVisitor *visitor) const
virtual bool CompactMode(const XMLElement &)
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
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
virtual bool ShallowEqual(const XMLNode *compare) const
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)
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
@ 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)
virtual XMLNode * ShallowClone(XMLDocument *document) const
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()
virtual XMLNode * ShallowClone(XMLDocument *document) const
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 bool ShallowEqual(const XMLNode *compare) const
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLError QueryIntAttribute(const char *name, int *value) const
virtual bool Accept(XMLVisitor *visitor) 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)
virtual bool Accept(XMLVisitor *visitor) const
@ XML_CAN_NOT_CONVERT_TEXT
@ 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.
static const Entity entities[NUM_ENTITIES]
XMLError QueryFloatText(float *fval) const
See QueryIntText()
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)
virtual bool Accept(XMLVisitor *visitor) const
virtual XMLNode * ShallowClone(XMLDocument *document) const
virtual bool Visit(const XMLText &text)
Visit a text node.
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]
virtual bool Accept(XMLVisitor *visitor) const
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)
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
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
XMLComment * NewComment(const char *comment)
void PushText(const char *text, bool cdata=false)
Add a text node.
XMLError QueryIntValue(int *value) const
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)