#ifndef JEZUK_SimpleDOM_DOCUMENTFRAGMENTIMPL_H #define JEZUK_SimpleDOM_DOCUMENTFRAGMENTIMPL_H #include namespace Arabica { namespace SimpleDOM { template class DocumentFragmentImpl : public DOM::DocumentFragment_impl, public NodeImplWithChildren { typedef NodeImplWithChildren NodeT; public: typedef DOM::Node_impl DOMNode_implT; DocumentFragmentImpl(DocumentImpl* ownerDoc) : DOM::DocumentFragment_impl(), NodeImplWithChildren(ownerDoc) { } // DocumentFragmentImpl virtual ~DocumentFragmentImpl() { } /////////////////////////////////////////////////////// // DOM::Node methods virtual DOM::Node_base::Type getNodeType() const { return DOM::Node_base::DOCUMENT_FRAGMENT_NODE; } // getNodeType virtual DOMNode_implT* cloneNode(bool deep) const { DOMNode_implT* clone = NodeT::ownerDoc_->createDocumentFragment(); if(deep) for(DOMNode_implT* c = NodeT::getFirstChild(); c != 0; c = c->getNextSibling()) clone->appendChild(c->cloneNode(true)); return clone; } // cloneNode virtual const stringT& getNodeName() const { static const stringT frag = string_adaptorT::construct_from_utf8("#document-fragment"); return frag; } // getNodeName virtual DOMNode_implT* getParentNode() const { return 0; } // getParentNode private: virtual void checkChildType(DOMNode_implT* child) { typename DOM::Node_base::Type type = child->getNodeType(); if((type != DOM::Node_base::ELEMENT_NODE) && (type != DOM::Node_base::PROCESSING_INSTRUCTION_NODE) && (type != DOM::Node_base::COMMENT_NODE) && (type != DOM::Node_base::TEXT_NODE) && (type != DOM::Node_base::CDATA_SECTION_NODE) && (type != DOM::Node_base::ENTITY_REFERENCE_NODE)) throw DOM::DOMException(DOM::DOMException::HIERARCHY_REQUEST_ERR); } // checkChildType }; // class DocumentFragmentImpl } // namespace SAX2DOM } // namespace Arabica #endif