diff --git a/tinyxml2.cpp b/tinyxml2.cpp index ae6a747..a11be4b 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -31,69 +31,8 @@ static const char CR = CARRIAGE_RETURN; } -// --------- XMLNode ----------- // - -XMLNode::XMLNode( XMLDocument* doc ) : - document( doc ), - parent( 0 ), - firstChild( 0 ), lastChild( 0 ), - prev( 0 ), next( 0 ) -{ - -} - - -XMLNode::~XMLNode() -{ - XMLNode* node=firstChild; - while( node ) { - XMLNode* temp = node->next; - delete node; - node = temp; - } -} - - -XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) -{ - if ( lastChild ) { - TIXMLASSERT( firstChild ); - TIXMLASSERT( lastChild->next == 0 ); - lastChild->next = addThis; - addThis->prev = lastChild; - lastChild = addThis; - - addThis->parent = this; - addThis->next = 0; - } - else { - TIXMLASSERT( firstChild == 0 ); - firstChild = lastChild = addThis; - - addThis->parent = this; - addThis->prev = 0; - addThis->next = 0; - } - return addThis; -} - - -void XMLNode::Print( FILE* fp, int depth ) -{ - for( XMLNode* node = firstChild; node; node=node->next ) { - node->Print( fp, depth ); - } -} - -void XMLNode::PrintSpace( FILE* fp, int depth ) -{ - for( int i=0; i start ) { + *next = p; + return start; + } + return p+1; +} + + +char* XMLBase::Identify( XMLDocument* document, char* p, XMLNode** node ) +{ + XMLNode* returnNode = 0; + + p = XMLNode::SkipWhiteSpace( p ); + if( !p || !*p || *p != '<' ) + { + return 0; + } + + // What is this thing? + // - Elements start with a letter or underscore, but xml is reserved. + // - Comments: "; + " line 2\r" + " line 3\r\n" + " line 4\n\r" + " line 5\r-->"; + + XMLDocument doc; + doc.Parse( test ); + doc.Print( stdout ); + } +#endif + { + static const char* test = ""; XMLDocument doc; doc.Parse( test );