mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
Prevent hierarchy exception if the parser reports the DTD as a skipped entity
This commit is contained in:
parent
cc1ad0ca24
commit
9cd4752c00
1 changed files with 5 additions and 1 deletions
|
@ -82,6 +82,7 @@ class Parser : protected SAX::basic_DefaultHandler<stringT>
|
|||
document_ = di.createDocument(string_adaptorT::construct_from_utf8(""), string_adaptorT::construct_from_utf8(""), 0);
|
||||
currentNode_ = document_;
|
||||
inCDATA_ = false;
|
||||
inDTD_ = false;
|
||||
inEntity_ = 0;
|
||||
|
||||
SAX_parser parser;
|
||||
|
@ -143,6 +144,7 @@ class Parser : protected SAX::basic_DefaultHandler<stringT>
|
|||
Features features_;
|
||||
|
||||
bool inCDATA_;
|
||||
bool inDTD_;
|
||||
int inEntity_;
|
||||
|
||||
std::map<stringT, EntityT*> declaredEntities_;
|
||||
|
@ -246,7 +248,7 @@ class Parser : protected SAX::basic_DefaultHandler<stringT>
|
|||
|
||||
virtual void skippedEntity(const stringT& name)
|
||||
{
|
||||
if(currentNode_ == 0)
|
||||
if(currentNode_ == 0 || inDTD_ == true)
|
||||
return;
|
||||
|
||||
currentNode_.appendChild(document_.createEntityReference(name));
|
||||
|
@ -280,11 +282,13 @@ class Parser : protected SAX::basic_DefaultHandler<stringT>
|
|||
{
|
||||
documentType_ = new DocumentType<stringT, string_adaptorT >(name, publicId, systemId);
|
||||
document_.insertBefore(documentType_, 0);
|
||||
inDTD_ = true;
|
||||
} // startDTD
|
||||
|
||||
virtual void endDTD()
|
||||
{
|
||||
documentType_->setReadOnly(true);
|
||||
inDTD_ = false;
|
||||
} // endDTD
|
||||
|
||||
virtual void startEntity(const stringT& name)
|
||||
|
|
Loading…
Reference in a new issue