mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
don't blow up when parsing DTDs
This commit is contained in:
parent
56b1aff551
commit
205fd30cf0
2 changed files with 8 additions and 7 deletions
|
@ -32,9 +32,9 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
|
|||
BaseDT::addNotation(notation);
|
||||
} // addNotation
|
||||
|
||||
void addElement(SimpleDOM::ElementImpl<stringT, string_adaptorT>* element)
|
||||
void addElement(const stringT& name)
|
||||
{
|
||||
BaseDT::addElement(element);
|
||||
BaseDT::addElement(new SimpleDOM::ElementImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, name));
|
||||
} // addElement
|
||||
|
||||
void addDefaultAttr(const stringT& elementName, const stringT& attributeName, const stringT& attributeValue)
|
||||
|
@ -42,8 +42,8 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
|
|||
SimpleDOM::ElementImpl<stringT, string_adaptorT>* elem = dynamic_cast<SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName));
|
||||
if(elem == 0)
|
||||
{
|
||||
elem = new SimpleDOM::ElementImpl<stringT, string_adaptorT>(0, elementName);
|
||||
addElement(elem);
|
||||
addElement(elementName);
|
||||
elem = dynamic_cast<SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName));
|
||||
}
|
||||
SimpleDOM::AttrImpl<stringT, string_adaptorT>* attr = new SimpleDOM::AttrImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, attributeName);
|
||||
attr->setValue(attributeValue);
|
||||
|
|
|
@ -54,8 +54,9 @@ class Parser : protected SAX::basic_DefaultHandler2<stringT>
|
|||
{
|
||||
typename Features::iterator f = features_.find(name);
|
||||
if(f == features_.end())
|
||||
throw SAX::SAXNotRecognizedException(std::string("Feature not recognized ") + string_adaptorT::asStdString(name));
|
||||
f->second = value;
|
||||
features_.insert(std::make_pair(name, value));
|
||||
else
|
||||
f->second = value;
|
||||
} // setFeature
|
||||
|
||||
bool getFeature(const stringT& name) const
|
||||
|
@ -324,7 +325,7 @@ class Parser : protected SAX::basic_DefaultHandler2<stringT>
|
|||
// DeclHandler
|
||||
virtual void elementDecl(const stringT& name, const stringT& model)
|
||||
{
|
||||
documentType_->addElement(new ElementT(0, name));
|
||||
documentType_->addElement(name);
|
||||
} // elementDecl
|
||||
|
||||
virtual void attributeDecl(const stringT& elementName,
|
||||
|
|
Loading…
Add table
Reference in a new issue