#ifndef JEZUK_SimpleDOM_ENTITYIMPL_H #define JEZUK_SimpleDOM_ENTITYIMPL_H #include #include namespace SimpleDOM { template class EntityImpl : public DOM::Entity_impl, public NodeImplWithChildren { typedef NodeImplWithChildren NodeT; public: EntityImpl(DocumentImpl* ownerDoc, stringT name, stringT publicId, stringT systemId, stringT notationName) : DOM::Entity_impl(), NodeImplWithChildren(ownerDoc), name_(name), publicId_(publicId), systemId_(systemId), notationName_(notationName) { } // EntityImpl virtual ~EntityImpl() { } /////////////////////////////////////////////////////// // DOM::Entity methods virtual stringT getPublicId() const { return publicId_; } virtual stringT getSystemId() const { return systemId_; } virtual stringT getNotationName() const { return notationName_; } /////////////////////////////////////////////////////// // DOM::Node methods virtual typename DOM::Node::Type getNodeType() const { return DOM::Node::ENTITY_NODE; } // getNodeType virtual const stringT& getNodeName() const { return name_; } // getNodeName virtual typename DOM::Node_impl* cloneNode(bool deep) const { EntityImpl* clone = new EntityImpl(NodeT::ownerDoc_, name_, publicId_, systemId_, notationName_); if(deep) for(DOM::Node_impl* c = NodeT::getFirstChild(); c != 0; c = c->getNextSibling()) clone->appendChild(c->cloneNode(true)); NodeT::ownerDoc_->orphaned(clone); return clone; } // cloneNode virtual DOM::Node_impl* getParentNode() const { return 0; } // getParentNode /////////////////////////////////////////////// virtual void checkChildType(DOM::Node_impl* child) { typename DOM::Node::Type type = child->getNodeType(); if((type != DOM::Node::ELEMENT_NODE) && (type != DOM::Node::PROCESSING_INSTRUCTION_NODE) && (type != DOM::Node::COMMENT_NODE) && (type != DOM::Node::TEXT_NODE) && (type != DOM::Node::CDATA_SECTION_NODE) && (type != DOM::Node::ENTITY_REFERENCE_NODE)) throw DOM::DOMException(DOM::DOMException::HIERARCHY_REQUEST_ERR); } // checkChildType private: stringT name_; stringT publicId_; stringT systemId_; stringT notationName_; }; // class EntityImpl } // namespace SAX2DOM #endif