From 0b611b7bd28851fe8096b3d2c121c68e231ada11 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 26 Apr 2014 11:21:10 +0200 Subject: Implemented global DOM document cache * the plan to return XML-nodes from each external function requires a better way to manage the lifetime of many xerces DOM document instances and their support class instances ** this is why DomDocumentCache and DomDocumentCache::item were implemented ** based on std::map so we can easily access the result of old function calls * changed external read-directory function to return the children of the document node instead of the document node itself ** removes unnecessary cruft in function calls ** will make returning status codes alongside the function result more pleasing to the eye * updated test transformation to reflect new features --- src/support/dom_document_guard.cc | 45 --------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/support/dom_document_guard.cc (limited to 'src/support/dom_document_guard.cc') diff --git a/src/support/dom_document_guard.cc b/src/support/dom_document_guard.cc deleted file mode 100644 index a83345f..0000000 --- a/src/support/dom_document_guard.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include "support/dom_document_guard.h" - -#include -#include - -namespace InputXSLT { - -DomDocumentGuard::DomDocumentGuard(const std::string& rootNode): - parser_(), - dom_support_(parser_), - root_node_name_( - xercesc::XMLString::transcode(rootNode.data()) - ), - document_( - xercesc::DOMImplementation::getImplementation()->createDocument( - nullptr, - root_node_name_, - nullptr - ) - ), - parsed_source_() { } - -DomDocumentGuard::~DomDocumentGuard() { - xercesc::XMLString::release(&this->root_node_name_); - - this->document_->release(); -} - -xercesc::DOMDocument* DomDocumentGuard::operator->() { - return this->document_; -} - -xalan::XalanDocument* DomDocumentGuard::finalize() { - this->parsed_source_.reset( - new xalan::XercesDOMWrapperParsedSource( - document_, - parser_, - dom_support_ - ) - ); - - return this->parsed_source_->getDocument(); -} - -} -- cgit v1.2.3