Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: a76b1c4915
Fetching contributors…

Cannot retrieve contributors at this time

70 lines (50 sloc) 1.299 kB
#include "settings.h"
#include <libxml/xmlstring.h>
#include "xml_node.h"
#include "xscript/xml_util.h"
#ifdef HAVE_DMALLOC_H
#include <dmalloc.h>
#endif
namespace xscript {
XmlNodeCommon::XmlNodeCommon()
: node_(NULL) {
}
XmlNodeCommon::~XmlNodeCommon() {
}
xmlNodePtr XmlNodeCommon::getNode() const {
return node_;
}
void
XmlNodeCommon::setContent(const char* val) {
xmlNodeSetContent(node_, (const xmlChar*) val);
}
void
XmlNodeCommon::setProperty(const char* name, const char* val) {
xmlNewProp(node_, (const xmlChar*) name, (const xmlChar*) val);
}
void
XmlNodeCommon::setType(const char* type_str) {
setProperty("type", type_str);
}
XmlNode::XmlNode(const char* name)
: XmlNodeCommon() {
node_ = xmlNewNode(NULL, (const xmlChar*) name);
XmlUtils::throwUnless(NULL != node_);
}
XmlNode::~XmlNode() {
if (node_ != NULL) {
xmlFreeNode(node_);
}
}
xmlNodePtr
XmlNode::releaseNode() {
xmlNodePtr ret_node = node_;
node_ = NULL;
return ret_node;
}
XmlChildNode::XmlChildNode(xmlNodePtr parent, const char* name, const char* val)
: XmlNodeCommon() {
node_ = xmlNewTextChild(parent, NULL, (const xmlChar*) name, (const xmlChar*) val);
XmlUtils::throwUnless(NULL != node_);
}
} // namespace xscript
Jump to Line
Something went wrong with that request. Please try again.