tinyxml2
tinyxml2 copied to clipboard
Why LoadFile dont't check parse error?
The source code like:
XMLError XMLDocument::LoadFile( FILE* fp )
{
Clear();
// .... ....
Parse();
// so why don't check error here
return _errorID;
}
but in another parse function:
XMLError XMLDocument::Parse( const char* p, size_t len )
{
Clear();
// ... ...
Parse();
// here check errors and do some cleaning
if ( Error() ) {
// clean up now essentially dangling memory.
// and the parse fail can put objects in the
// pools that are dead and inaccessible.
DeleteChildren();
_elementPool.Clear();
_attributePool.Clear();
_textPool.Clear();
_commentPool.Clear();
}
return _errorID;
}
Does anyone knows the secrets? Thanks!
I wonder the same thing