summaryrefslogtreecommitdiff
path: root/src/pugixml.hpp
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-07 04:49:23 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-12-07 04:49:23 +0000
commit456527b44a8a2f23c819a67b1df6efd520cf25ae (patch)
tree188b96d9b697743133b5cbabe17bb724af4b0548 /src/pugixml.hpp
parentefc634a7183527416ded491285bc566e16db1e97 (diff)
Implement xml_node::append_buffer as a faster alternative to assembling documents from fragments (compared to parse & clone)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@936 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r--src/pugixml.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 4ca5197..a736f53 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -201,6 +201,8 @@ namespace pugi
class xml_tree_walker;
+ struct xml_parse_result;
+
class xml_node;
class xml_text;
@@ -473,6 +475,11 @@ namespace pugi
bool remove_child(const xml_node& n);
bool remove_child(const char_t* name);
+ // Parses buffer as an XML document fragment and appends all nodes as children of the current node.
+ // Copies/converts the buffer, so it may be deleted or changed after the function returns.
+ // Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
+ xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
+
// Find attribute using predicate. Returns first attribute for which predicate returned true.
template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
{
@@ -821,7 +828,9 @@ namespace pugi
status_bad_start_element, // Parsing error occurred while parsing start element tag
status_bad_attribute, // Parsing error occurred while parsing element attribute
status_bad_end_element, // Parsing error occurred while parsing end element tag
- status_end_element_mismatch // There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
+ status_end_element_mismatch,// There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
+
+ status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer)
};
// Parsing result