diff --git a/DOM/SAX2DOM/DocumentTypeImpl.h b/DOM/SAX2DOM/DocumentTypeImpl.h index 38de7d2f..b2de3e5c 100644 --- a/DOM/SAX2DOM/DocumentTypeImpl.h +++ b/DOM/SAX2DOM/DocumentTypeImpl.h @@ -32,9 +32,9 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl* element) + void addElement(const stringT& name) { - BaseDT::addElement(element); + BaseDT::addElement(new SimpleDOM::ElementImpl(BaseDT::ownerDoc_, name)); } // addElement void addDefaultAttr(const stringT& elementName, const stringT& attributeName, const stringT& attributeValue) @@ -42,8 +42,8 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl* elem = dynamic_cast*>(BaseDT::getElements()->getNamedItem(elementName)); if(elem == 0) { - elem = new SimpleDOM::ElementImpl(0, elementName); - addElement(elem); + addElement(elementName); + elem = dynamic_cast*>(BaseDT::getElements()->getNamedItem(elementName)); } SimpleDOM::AttrImpl* attr = new SimpleDOM::AttrImpl(BaseDT::ownerDoc_, attributeName); attr->setValue(attributeValue); diff --git a/DOM/SAX2DOM/SAX2DOM.h b/DOM/SAX2DOM/SAX2DOM.h index 43cf643d..a71b4c1b 100644 --- a/DOM/SAX2DOM/SAX2DOM.h +++ b/DOM/SAX2DOM/SAX2DOM.h @@ -54,8 +54,9 @@ class Parser : protected SAX::basic_DefaultHandler2 { 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 // 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,