31 #if defined( DEBUG_PARSER )
32 # if defined( DEBUG ) && defined( _MSC_VER )
34 # define TIXML_LOG OutputDebugString
36 # define TIXML_LOG printf
43 TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
48 {
""", 6,
'\"' },
62 const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
63 const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
64 const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
66 const int TiXmlBase::utf8ByteTable[256] =
69 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
70 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
71 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
72 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
73 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
74 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
75 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
76 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
77 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
78 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
79 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
80 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
81 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
84 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
88 void TiXmlBase::ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length )
90 const unsigned long BYTE_MASK = 0xBF;
91 const unsigned long BYTE_MARK = 0x80;
92 const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
96 else if ( input < 0x800 )
98 else if ( input < 0x10000 )
100 else if ( input < 0x200000 )
103 { *length = 0;
return; }
112 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
116 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
120 *output = (char)((input | BYTE_MARK) & BYTE_MASK);
124 *output = (char)(input | FIRST_BYTE_MARK[*length]);
129 int TiXmlBase::IsAlpha(
unsigned char anyByte, TiXmlEncoding )
139 return isalpha( anyByte );
150 int TiXmlBase::IsAlphaNum(
unsigned char anyByte, TiXmlEncoding )
160 return isalnum( anyByte );
175 void Stamp(
const char* now, TiXmlEncoding encoding );
196 void TiXmlParsingData::Stamp(
const char* now, TiXmlEncoding encoding )
207 int row = cursor.row;
208 int col = cursor.col;
209 const char* p = stamp;
215 const unsigned char* pU = (
const unsigned char*)p;
258 col = (col / tabsize + 1) * tabsize;
261 case TIXML_UTF_LEAD_0:
262 if ( encoding == TIXML_ENCODING_UTF8 )
264 if ( *(p+1) && *(p+2) )
268 if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
270 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
272 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
286 if ( encoding == TIXML_ENCODING_UTF8 )
289 int step = TiXmlBase::utf8ByteTable[*((
const unsigned char*)p)];
307 assert( cursor.row >= -1 );
308 assert( cursor.col >= -1 );
314 const char* TiXmlBase::SkipWhiteSpace(
const char* p, TiXmlEncoding encoding )
320 if ( encoding == TIXML_ENCODING_UTF8 )
324 const unsigned char* pU = (
const unsigned char*)p;
327 if ( *(pU+0)==TIXML_UTF_LEAD_0
328 && *(pU+1)==TIXML_UTF_LEAD_1
329 && *(pU+2)==TIXML_UTF_LEAD_2 )
334 else if(*(pU+0)==TIXML_UTF_LEAD_0
341 else if(*(pU+0)==TIXML_UTF_LEAD_0
349 if ( IsWhiteSpace( *p ) )
357 while ( *p && IsWhiteSpace( *p ) )
365 bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag )
369 if ( !in->good() )
return false;
373 if ( !IsWhiteSpace( c ) || c <= 0 )
376 *tag += (char) in->get();
380 bool TiXmlBase::StreamTo( std::istream * in,
int character, TIXML_STRING * tag )
386 if ( c == character )
401 const char* TiXmlBase::ReadName(
const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
417 && ( IsAlpha( (
unsigned char) *p, encoding ) || *p ==
'_' ) )
419 const char* start = p;
421 && ( IsAlphaNum( (
unsigned char ) *p, encoding )
431 name->assign( start, p-start );
438 const char* TiXmlBase::GetEntity(
const char* p,
char* value,
int* length, TiXmlEncoding encoding )
445 if ( *(p+1) && *(p+1) ==
'#' && *(p+2) )
447 unsigned long ucs = 0;
454 if ( !*(p+3) )
return 0;
457 q = strchr( q,
';' );
459 if ( !q || !*q )
return 0;
466 if ( *q >=
'0' && *q <=
'9' )
467 ucs += mult * (*q -
'0');
468 else if ( *q >=
'a' && *q <=
'f' )
469 ucs += mult * (*q -
'a' + 10);
470 else if ( *q >=
'A' && *q <=
'F' )
471 ucs += mult * (*q -
'A' + 10 );
481 if ( !*(p+2) )
return 0;
484 q = strchr( q,
';' );
486 if ( !q || !*q )
return 0;
493 if ( *q >=
'0' && *q <=
'9' )
494 ucs += mult * (*q -
'0');
501 if ( encoding == TIXML_ENCODING_UTF8 )
504 ConvertUTF32ToUTF8( ucs, value, length );
511 return p + delta + 1;
515 for( i=0; i<NUM_ENTITY; ++i )
517 if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
519 assert( strlen( entity[i].str ) == entity[i].strLength );
520 *value = entity[i].chr;
522 return ( p + entity[i].strLength );
534 bool TiXmlBase::StringEqual(
const char* p,
537 TiXmlEncoding encoding )
551 while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
562 while ( *q && *tag && *q == *tag )
574 const char* TiXmlBase::ReadText(
const char* p,
578 bool caseInsensitive,
579 TiXmlEncoding encoding )
583 || !condenseWhiteSpace )
587 && !StringEqual( p, endTag, caseInsensitive, encoding )
591 char cArr[4] = { 0, 0, 0, 0 };
592 p = GetChar( p, cArr, &len, encoding );
593 text->append( cArr, len );
598 bool whitespace =
false;
601 p = SkipWhiteSpace( p, encoding );
603 && !StringEqual( p, endTag, caseInsensitive, encoding ) )
605 if ( *p ==
'\r' || *p ==
'\n' )
610 else if ( IsWhiteSpace( *p ) )
625 char cArr[4] = { 0, 0, 0, 0 };
626 p = GetChar( p, cArr, &len, encoding );
630 text->append( cArr, len );
635 p += strlen( endTag );
641 void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
650 if ( !StreamTo( in,
'<', tag ) )
652 SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
658 int tagIndex = (int) tag->length();
659 while ( in->good() && in->peek() !=
'>' )
664 SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
675 TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
679 node->StreamIn( in, tag );
693 SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
699 SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
713 SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
723 location.row = prevData->cursor.row;
724 location.col = prevData->cursor.col;
732 location = data.Cursor();
734 if ( encoding == TIXML_ENCODING_UNKNOWN )
737 const unsigned char* pU = (
const unsigned char*)p;
738 if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
739 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
740 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
742 encoding = TIXML_ENCODING_UTF8;
743 useMicrosoftBOM =
true;
747 p = SkipWhiteSpace( p, encoding );
750 SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
756 TiXmlNode* node = Identify( p, encoding );
759 p = node->Parse( p, &data, encoding );
768 if ( encoding == TIXML_ENCODING_UNKNOWN
776 encoding = TIXML_ENCODING_UTF8;
777 else if ( StringEqual( enc,
"UTF-8",
true, TIXML_ENCODING_UNKNOWN ) )
778 encoding = TIXML_ENCODING_UTF8;
779 else if ( StringEqual( enc,
"UTF8",
true, TIXML_ENCODING_UNKNOWN ) )
780 encoding = TIXML_ENCODING_UTF8;
782 encoding = TIXML_ENCODING_LEGACY;
785 p = SkipWhiteSpace( p, encoding );
790 SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
798 void TiXmlDocument::SetError(
int err,
const char* pError,
TiXmlParsingData* data, TiXmlEncoding encoding )
804 assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
807 errorDesc = errorString[ errorId ];
809 errorLocation.Clear();
810 if ( pError && data )
812 data->Stamp( pError, encoding );
813 errorLocation = data->Cursor();
818 TiXmlNode* TiXmlNode::Identify(
const char* p, TiXmlEncoding encoding )
822 p = SkipWhiteSpace( p, encoding );
823 if( !p || !*p || *p !=
'<' )
828 p = SkipWhiteSpace( p, encoding );
842 const char* xmlHeader = {
"<?xml" };
843 const char* commentHeader = {
"<!--" };
844 const char* dtdHeader = {
"<!" };
845 const char* cdataHeader = {
"<![CDATA[" };
847 if ( StringEqual( p, xmlHeader,
true, encoding ) )
850 TIXML_LOG(
"XML parsing Declaration\n" );
854 else if ( StringEqual( p, commentHeader,
false, encoding ) )
857 TIXML_LOG(
"XML parsing Comment\n" );
861 else if ( StringEqual( p, cdataHeader,
false, encoding ) )
864 TIXML_LOG(
"XML parsing CDATA\n" );
870 else if ( StringEqual( p, dtdHeader,
false, encoding ) )
873 TIXML_LOG(
"XML parsing Unknown(1)\n" );
877 else if ( IsAlpha( *(p+1), encoding )
881 TIXML_LOG(
"XML parsing Element\n" );
888 TIXML_LOG(
"XML parsing Unknown(2)\n" );
896 returnNode->parent =
this;
903 void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
914 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
923 if ( tag->length() < 3 )
return;
928 if ( tag->at( tag->length() - 1 ) ==
'>'
929 && tag->at( tag->length() - 2 ) ==
'/' )
934 else if ( tag->at( tag->length() - 1 ) ==
'>' )
943 StreamWhiteSpace( in, tag );
946 if ( in->good() && in->peek() !=
'<' )
950 text.StreamIn( in, tag );
959 if ( !in->good() )
return;
960 assert( in->peek() ==
'<' );
961 int tagIndex = (int) tag->length();
963 bool closingTag =
false;
964 bool firstCharFound =
false;
976 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
987 if ( c ==
'[' && tag->size() >= 9 )
989 size_t len = tag->size();
990 const char* start = tag->c_str() + len - 9;
991 if ( strcmp( start,
"<![CDATA[" ) == 0 ) {
992 assert( !closingTag );
997 if ( !firstCharFound && c !=
'<' && !IsWhiteSpace( c ) )
999 firstCharFound =
true;
1016 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
1028 const char* tagloc = tag->c_str() + tagIndex;
1029 TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING );
1032 node->StreamIn( in, tag );
1043 const char* TiXmlElement::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1045 p = SkipWhiteSpace( p, encoding );
1050 if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
1056 data->Stamp( p, encoding );
1057 location = data->Cursor();
1062 if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
1066 p = SkipWhiteSpace( p+1, encoding );
1069 const char* pErr = p;
1071 p = ReadName( p, &value, encoding );
1074 if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
1078 TIXML_STRING endTag (
"</");
1086 p = SkipWhiteSpace( p, encoding );
1089 if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
1098 if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
1103 else if ( *p ==
'>' )
1109 p = ReadValue( p, data, encoding );
1113 if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
1122 if ( StringEqual( p, endTag.c_str(),
false, encoding ) )
1124 p += endTag.length();
1125 p = SkipWhiteSpace( p, encoding );
1126 if ( p && *p && *p ==
'>' ) {
1130 if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
1135 if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
1148 attrib->SetDocument( document );
1150 p = attrib->Parse( p, data, encoding );
1154 if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
1160 #ifdef TIXML_USE_STL
1167 if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
1172 attributeSet.Add( attrib );
1179 const char* TiXmlElement::ReadValue(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1184 const char* pWithWhiteSpace = p;
1185 p = SkipWhiteSpace( p, encoding );
1201 p = textNode->Parse( p, data, encoding );
1207 p = textNode->Parse( pWithWhiteSpace, data, encoding );
1210 if ( !textNode->Blank() )
1220 if ( StringEqual( p,
"</",
false, encoding ) )
1226 TiXmlNode* node = Identify( p, encoding );
1229 p = node->Parse( p, data, encoding );
1238 pWithWhiteSpace = p;
1239 p = SkipWhiteSpace( p, encoding );
1244 if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
1250 #ifdef TIXML_USE_STL
1251 void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag )
1253 while ( in->good() )
1260 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
1275 const char* TiXmlUnknown::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1278 p = SkipWhiteSpace( p, encoding );
1282 data->Stamp( p, encoding );
1283 location = data->Cursor();
1285 if ( !p || !*p || *p !=
'<' )
1287 if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
1293 while ( p && *p && *p !=
'>' )
1301 if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
1308 #ifdef TIXML_USE_STL
1309 void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag )
1311 while ( in->good() )
1318 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
1325 && tag->at( tag->length() - 2 ) ==
'-'
1326 && tag->at( tag->length() - 3 ) ==
'-' )
1336 const char* TiXmlComment::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1341 p = SkipWhiteSpace( p, encoding );
1345 data->Stamp( p, encoding );
1346 location = data->Cursor();
1348 const char* startTag =
"<!--";
1349 const char* endTag =
"-->";
1351 if ( !StringEqual( p, startTag,
false, encoding ) )
1353 document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
1356 p += strlen( startTag );
1378 while ( p && *p && !StringEqual( p, endTag,
false, encoding ) )
1380 value.append( p, 1 );
1384 p += strlen( endTag );
1390 const char* TiXmlAttribute::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1392 p = SkipWhiteSpace( p, encoding );
1393 if ( !p || !*p )
return 0;
1397 data->Stamp( p, encoding );
1398 location = data->Cursor();
1401 const char* pErr = p;
1402 p = ReadName( p, &name, encoding );
1405 if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
1408 p = SkipWhiteSpace( p, encoding );
1409 if ( !p || !*p || *p !=
'=' )
1411 if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
1416 p = SkipWhiteSpace( p, encoding );
1419 if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
1424 const char SINGLE_QUOTE =
'\'';
1425 const char DOUBLE_QUOTE =
'\"';
1427 if ( *p == SINGLE_QUOTE )
1431 p = ReadText( p, &value,
false, end,
false, encoding );
1433 else if ( *p == DOUBLE_QUOTE )
1437 p = ReadText( p, &value,
false, end,
false, encoding );
1446 && !IsWhiteSpace( *p )
1447 && *p !=
'/' && *p !=
'>' )
1449 if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
1453 if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
1463 #ifdef TIXML_USE_STL
1464 void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
1466 while ( in->good() )
1469 if ( !cdata && (c ==
'<' ) )
1477 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
1484 if ( cdata && c ==
'>' && tag->size() >= 3 ) {
1485 size_t len = tag->size();
1486 if ( (*tag)[len-2] ==
']' && (*tag)[len-3] ==
']' ) {
1495 const char* TiXmlText::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding )
1502 data->Stamp( p, encoding );
1503 location = data->Cursor();
1506 const char*
const startTag =
"<![CDATA[";
1507 const char*
const endTag =
"]]>";
1509 if ( cdata || StringEqual( p, startTag,
false, encoding ) )
1513 if ( !StringEqual( p, startTag,
false, encoding ) )
1515 document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
1518 p += strlen( startTag );
1522 && !StringEqual( p, endTag,
false, encoding )
1530 p = ReadText( p, &dummy,
false, endTag,
false, encoding );
1535 bool ignoreWhite =
true;
1537 const char* end =
"<";
1538 p = ReadText( p, &value, ignoreWhite, end,
false, encoding );
1545 #ifdef TIXML_USE_STL
1546 void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag )
1548 while ( in->good() )
1555 document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
1569 const char* TiXmlDeclaration::Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding _encoding )
1571 p = SkipWhiteSpace( p, _encoding );
1575 if ( !p || !*p || !StringEqual( p,
"<?xml",
true, _encoding ) )
1577 if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
1582 data->Stamp( p, _encoding );
1583 location = data->Cursor();
1599 p = SkipWhiteSpace( p, _encoding );
1600 if ( StringEqual( p,
"version",
true, _encoding ) )
1603 p = attrib.Parse( p, data, _encoding );
1604 version = attrib.
Value();
1606 else if ( StringEqual( p,
"encoding",
true, _encoding ) )
1609 p = attrib.Parse( p, data, _encoding );
1610 encoding = attrib.
Value();
1612 else if ( StringEqual( p,
"standalone",
true, _encoding ) )
1615 p = attrib.Parse( p, data, _encoding );
1616 standalone = attrib.
Value();
1621 while( p && *p && *p !=
'>' && !IsWhiteSpace( *p ) )
1628 bool TiXmlText::Blank()
const
1630 for (
unsigned i=0; i<value.length(); i++ )
1631 if ( !IsWhiteSpace( value[i] ) )
An attribute is a name-value pair.
void ClearError()
If you have handled the error, it can be reset with this call.
const char * Value() const
Return the value of this attribute.
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
const char * Encoding() const
Encoding. Will return an empty string if none was found.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
const char * Name() const
Return the name of this attribute.
In correct XML the declaration is the first entry in the file.
Any tag that tinyXml doesn't recognize is saved as an unknown.
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Always the top level node.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
The parent class for everything in the Document Object Model.
The element is a container class.