fix BOM preservation bugs. add new tests

This commit is contained in:
Lee Thomason (grinliz)
2013-04-29 09:15:37 -07:00
parent 1377fe7ec0
commit d0a38c3a20
2 changed files with 38 additions and 5 deletions

View File

@@ -1663,6 +1663,7 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
XMLError XMLDocument::Parse( const char* p, size_t len )
{
const char* start = p;
Clear();
if ( !p || !*p ) {
@@ -1683,7 +1684,8 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
return _errorID;
}
ParseDeep( _charBuffer, 0 );
int delta = p - start; // skip initial whitespace, BOM, etc.
ParseDeep( _charBuffer+delta, 0 );
return _errorID;
}