diff options
Diffstat (limited to 'src/support/dom/result_node_facade.cc')
-rw-r--r-- | src/support/dom/result_node_facade.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/support/dom/result_node_facade.cc b/src/support/dom/result_node_facade.cc new file mode 100644 index 0000000..597448b --- /dev/null +++ b/src/support/dom/result_node_facade.cc @@ -0,0 +1,61 @@ +#include "result_node_facade.h" + +#include <xercesc/dom/DOMText.hpp> + +#include "support/xerces_string_guard.h" + +namespace InputXSLT { + +ResultNodeFacade::ResultNodeFacade( + xercesc::DOMDocument* document, + xercesc::DOMNode* node, + const std::string& name +): + dom_document_(document), + result_node_( + dom_document_->createElement(*XercesStringGuard<XMLCh>(name)) + ), + root_node_(node) { } + +ResultNodeFacade::~ResultNodeFacade() { + this->root_node_->appendChild(this->result_node_); +} + +void ResultNodeFacade::setAttribute( + const std::string& name, + const std::string& value +) { + this->result_node_->setAttribute( + *XercesStringGuard<XMLCh>(name), + *XercesStringGuard<XMLCh>(value) + ); +} + +void ResultNodeFacade::setValueNode( + const std::string& name, + const std::string& value +) { + xercesc::DOMElement* const nameNode( + this->dom_document_->createElement(*XercesStringGuard<XMLCh>(name)) + ); + + xercesc::DOMText* const valueNode( + this->dom_document_->createTextNode(*XercesStringGuard<XMLCh>(value)) + ); + + nameNode->appendChild(valueNode); + + this->result_node_->appendChild(nameNode); +} + +void ResultNodeFacade::setContent(const std::string& content) { + this->result_node_->appendChild( + this->dom_document_->createTextNode(*XercesStringGuard<XMLCh>(content)) + ); +} + +void ResultNodeFacade::setContent(xercesc::DOMNode* node) { + this->result_node_->appendChild(node); +} + +} |