Merge branch 'patch-1' of https://github.com/SirR4T/tinyxml2 into SirR4T-patch-1

This commit is contained in:
Lee Thomason
2015-05-22 10:57:00 -07:00
2 changed files with 30 additions and 0 deletions

View File

@@ -887,6 +887,17 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
break;
}
XMLDeclaration* decl = node->ToDeclaration();
if ( decl ) {
// A declaration can only be the first child of a document.
// Set error, if document already has children.
if ( !_document->NoChildren() ) {
_document->SetError( XML_ERROR_PARSING_DECLARATION, decl->Value(), 0);
DeleteNode( decl );
break;
}
}
XMLElement* ele = node->ToElement();
if ( ele ) {
// We read the end tag. Return it to the parent.