summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp8
-rw-r--r--src/pugixml.hpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 6850589..ff5aaa9 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -4505,6 +4505,14 @@ namespace pugi
create();
}
+ void xml_document::reset(const xml_document& proto)
+ {
+ reset();
+
+ for (xml_node cur = proto.first_child(); cur; cur = cur.next_sibling())
+ append_copy(cur);
+ }
+
void xml_document::create()
{
// initialize sentinel page
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index ce4abe2..bb08064 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -740,6 +740,9 @@ namespace pugi
// Removes all nodes, leaving the empty document
void reset();
+ // Removes all nodes, then copies the entire contents of the specified document
+ void reset(const xml_document& proto);
+
#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);