diff --git a/tinyxml2.cpp b/tinyxml2.cpp index e923c48..aa3788f 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace tinyxml2; @@ -23,14 +24,49 @@ using namespace tinyxml2; } +const char* XMLNode::SkipWhiteSpace( const char* p ) +{ + while( isspace( *p ) ) { + ++p; + } + return p; +} + + XMLDocument::XMLDocument() : charBuffer( 0 ) { } -bool XMLDocument::Parse( const char* str ) +bool XMLDocument::Parse( const char* p ) { + 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: "; - XMLDocument doc; - doc.Parse( test ); - doc.Print( stdout ); + XMLDocument doc; + doc.Parse( test ); + doc.Print( stdout ); + } + /* + { + static const char* test = ""; + XMLDocument doc; + doc.Parse( test ); + doc.Print( stdout ); + } + */ return 0; } \ No newline at end of file