summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp36
-rw-r--r--src/pugixml.hpp10
2 files changed, 45 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 833e43e..6850589 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3989,6 +3989,42 @@ namespace pugi
return n;
}
+ xml_node xml_node::append_child(const char_t* name)
+ {
+ xml_node result = append_child(node_element);
+
+ result.set_name(name);
+
+ return result;
+ }
+
+ xml_node xml_node::prepend_child(const char_t* name)
+ {
+ xml_node result = prepend_child(node_element);
+
+ result.set_name(name);
+
+ return result;
+ }
+
+ xml_node xml_node::insert_child_after(const char_t* name, const xml_node& node)
+ {
+ xml_node result = insert_child_after(node_element, node);
+
+ result.set_name(name);
+
+ return result;
+ }
+
+ xml_node xml_node::insert_child_before(const char_t* name, const xml_node& node)
+ {
+ xml_node result = insert_child_before(node_element, node);
+
+ result.set_name(name);
+
+ return result;
+ }
+
xml_node xml_node::append_copy(const xml_node& proto)
{
xml_node result = append_child(proto.type());
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 63e0233..ce4abe2 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -428,6 +428,12 @@ namespace pugi
xml_node insert_child_after(xml_node_type type, const xml_node& node);
xml_node insert_child_before(xml_node_type type, const xml_node& node);
+ // Add child element with specified name. Returns added node, or empty node on errors.
+ xml_node append_child(const char_t* name);
+ xml_node prepend_child(const char_t* name);
+ xml_node insert_child_after(const char_t* name, const xml_node& node);
+ xml_node insert_child_before(const char_t* name, const xml_node& node);
+
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
xml_node append_copy(const xml_node& proto);
xml_node prepend_copy(const xml_node& proto);
@@ -719,7 +725,6 @@ namespace pugi
xml_document(const xml_document&);
const xml_document& operator=(const xml_document&);
- void reset();
void create();
void destroy();
@@ -732,6 +737,9 @@ namespace pugi
// Destructor, invalidates all node/attribute handles to this document
~xml_document();
+ // Removes all nodes, leaving the empty document
+ void reset();
+
#ifndef PUGIXML_NO_STL
// Load document from stream.
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);