Deal properly with the [dtd] pseudo-entity

Some parsers report the [dtd] pseudo entity through the LexicalHandler.
Arabica was incorrectly trying to create an Entity Reference for it.
This commit is contained in:
Jez Higgins 2012-09-14 11:12:50 +01:00
parent 0c37303b50
commit 2f49994b09
2 changed files with 650 additions and 639 deletions

View file

@ -323,6 +323,9 @@ class Parser : protected Arabica::SAX::DefaultHandler<stringT, typename ParserTy
if(--inEntity_ == 0)
currentNode_ = cachedCurrent_;
if(dtd_pseudo_entity == name)
return;
currentNode_.appendChild(document_.createEntityReference(name));
} // endEntity

View file

@ -185,6 +185,14 @@ public:
* @param text A string holding the comment.
*/
virtual void comment(const string_type& text) = 0;
const string_type dtd_pseudo_entity;
protected:
LexicalHandler() :
dtd_pseudo_entity(string_adaptor::construct_from_utf8("[dtd]"))
{
}
}; // class LexicalHandler
} // namespace SAX