summaryrefslogtreecommitdiff
path: root/docs/samples
diff options
context:
space:
mode:
Diffstat (limited to 'docs/samples')
-rw-r--r--docs/samples/custom_memory_management.cpp2
-rw-r--r--docs/samples/load_error_handling.cpp2
-rw-r--r--docs/samples/load_memory.cpp2
-rw-r--r--docs/samples/load_options.cpp8
-rw-r--r--docs/samples/modify_base.cpp2
-rw-r--r--docs/samples/modify_remove.cpp2
-rw-r--r--docs/samples/save_custom_writer.cpp4
-rw-r--r--docs/samples/save_declaration.cpp2
-rw-r--r--docs/samples/save_file.cpp2
-rw-r--r--docs/samples/save_options.cpp2
-rw-r--r--docs/samples/save_stream.cpp2
-rw-r--r--docs/samples/save_subtree.cpp2
-rw-r--r--docs/samples/text.cpp2
13 files changed, 17 insertions, 17 deletions
diff --git a/docs/samples/custom_memory_management.cpp b/docs/samples/custom_memory_management.cpp
index 92ccb71..f11d27e 100644
--- a/docs/samples/custom_memory_management.cpp
+++ b/docs/samples/custom_memory_management.cpp
@@ -21,7 +21,7 @@ int main()
//]
pugi::xml_document doc;
- doc.load("<node/>");
+ doc.load_string("<node/>");
}
// vim:et
diff --git a/docs/samples/load_error_handling.cpp b/docs/samples/load_error_handling.cpp
index 18dd331..8dceb99 100644
--- a/docs/samples/load_error_handling.cpp
+++ b/docs/samples/load_error_handling.cpp
@@ -6,7 +6,7 @@ void check_xml(const char* source)
{
//[code_load_error_handling
pugi::xml_document doc;
- pugi::xml_parse_result result = doc.load(source);
+ pugi::xml_parse_result result = doc.load_string(source);
if (result)
std::cout << "XML [" << source << "] parsed without errors, attr value: [" << doc.child("node").attribute("attr").value() << "]\n\n";
diff --git a/docs/samples/load_memory.cpp b/docs/samples/load_memory.cpp
index 1185944..490f7e4 100644
--- a/docs/samples/load_memory.cpp
+++ b/docs/samples/load_memory.cpp
@@ -55,7 +55,7 @@ int main()
{
//[code_load_memory_string
// You can use load to load document from null-terminated strings, for example literals:
- pugi::xml_parse_result result = doc.load("<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>");
+ pugi::xml_parse_result result = doc.load_string("<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>");
//]
std::cout << "Load result: " << result.description() << ", mesh name: " << doc.child("mesh").attribute("name").value() << std::endl;
diff --git a/docs/samples/load_options.cpp b/docs/samples/load_options.cpp
index 04b4b46..2589348 100644
--- a/docs/samples/load_options.cpp
+++ b/docs/samples/load_options.cpp
@@ -10,19 +10,19 @@ int main()
const char* source = "<!--comment--><node>&lt;</node>";
// Parsing with default options; note that comment node is not added to the tree, and entity reference &lt; is expanded
- doc.load(source);
+ doc.load_string(source);
std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
// Parsing with additional parse_comments option; comment node is now added to the tree
- doc.load(source, pugi::parse_default | pugi::parse_comments);
+ doc.load_string(source, pugi::parse_default | pugi::parse_comments);
std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
// Parsing with additional parse_comments option and without the (default) parse_escapes option; &lt; is not expanded
- doc.load(source, (pugi::parse_default | pugi::parse_comments) & ~pugi::parse_escapes);
+ doc.load_string(source, (pugi::parse_default | pugi::parse_comments) & ~pugi::parse_escapes);
std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
// Parsing with minimal option mask; comment node is not added to the tree, and &lt; is not expanded
- doc.load(source, pugi::parse_minimal);
+ doc.load_string(source, pugi::parse_minimal);
std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
//]
}
diff --git a/docs/samples/modify_base.cpp b/docs/samples/modify_base.cpp
index 7d0959a..bd63708 100644
--- a/docs/samples/modify_base.cpp
+++ b/docs/samples/modify_base.cpp
@@ -6,7 +6,7 @@
int main()
{
pugi::xml_document doc;
- if (!doc.load("<node id='123'>text</node><!-- comment -->", pugi::parse_default | pugi::parse_comments)) return -1;
+ if (!doc.load_string("<node id='123'>text</node><!-- comment -->", pugi::parse_default | pugi::parse_comments)) return -1;
//[code_modify_base_node
pugi::xml_node node = doc.child("node");
diff --git a/docs/samples/modify_remove.cpp b/docs/samples/modify_remove.cpp
index 28c2f6b..53020e1 100644
--- a/docs/samples/modify_remove.cpp
+++ b/docs/samples/modify_remove.cpp
@@ -5,7 +5,7 @@
int main()
{
pugi::xml_document doc;
- if (!doc.load("<node><description>Simple node</description><param name='id' value='123'/></node>")) return -1;
+ if (!doc.load_string("<node><description>Simple node</description><param name='id' value='123'/></node>")) return -1;
//[code_modify_remove
// remove description node with the whole subtree
diff --git a/docs/samples/save_custom_writer.cpp b/docs/samples/save_custom_writer.cpp
index 6ea4300..fe08b72 100644
--- a/docs/samples/save_custom_writer.cpp
+++ b/docs/samples/save_custom_writer.cpp
@@ -11,7 +11,7 @@ struct xml_string_writer: pugi::xml_writer
virtual void write(const void* data, size_t size)
{
- result += std::string(static_cast<const char*>(data), size);
+ result.append(static_cast<const char*>(data), size);
}
};
//]
@@ -94,7 +94,7 @@ int main()
{
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'>hey</foo>");
+ doc.load_string("<foo bar='baz'>hey</foo>");
// get contents as std::string (single pass)
std::cout << "contents: [" << node_to_string(doc) << "]\n";
diff --git a/docs/samples/save_declaration.cpp b/docs/samples/save_declaration.cpp
index 6c82061..a45831f 100644
--- a/docs/samples/save_declaration.cpp
+++ b/docs/samples/save_declaration.cpp
@@ -7,7 +7,7 @@ int main()
//[code_save_declaration
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'><call>hey</call></foo>");
+ doc.load_string("<foo bar='baz'><call>hey</call></foo>");
// add a custom declaration node
pugi::xml_node decl = doc.prepend_child(pugi::node_declaration);
diff --git a/docs/samples/save_file.cpp b/docs/samples/save_file.cpp
index 30c1aa1..21413a2 100644
--- a/docs/samples/save_file.cpp
+++ b/docs/samples/save_file.cpp
@@ -6,7 +6,7 @@ int main()
{
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'>hey</foo>");
+ doc.load_string("<foo bar='baz'>hey</foo>");
//[code_save_file
// save document to file
diff --git a/docs/samples/save_options.cpp b/docs/samples/save_options.cpp
index 6a49f66..82abdcd 100644
--- a/docs/samples/save_options.cpp
+++ b/docs/samples/save_options.cpp
@@ -7,7 +7,7 @@ int main()
//[code_save_options
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'><call>hey</call></foo>");
+ doc.load_string("<foo bar='baz'><call>hey</call></foo>");
// default options; prints
// <?xml version="1.0"?>
diff --git a/docs/samples/save_stream.cpp b/docs/samples/save_stream.cpp
index d01965d..eba1863 100644
--- a/docs/samples/save_stream.cpp
+++ b/docs/samples/save_stream.cpp
@@ -6,7 +6,7 @@ int main()
{
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'><call>hey</call></foo>");
+ doc.load_string("<foo bar='baz'><call>hey</call></foo>");
//[code_save_stream
// save document to standard output
diff --git a/docs/samples/save_subtree.cpp b/docs/samples/save_subtree.cpp
index 0091b3d..a94e10a 100644
--- a/docs/samples/save_subtree.cpp
+++ b/docs/samples/save_subtree.cpp
@@ -7,7 +7,7 @@ int main()
//[code_save_subtree
// get a test document
pugi::xml_document doc;
- doc.load("<foo bar='baz'><call>hey</call></foo>");
+ doc.load_string("<foo bar='baz'><call>hey</call></foo>");
// print document to standard output (prints <?xml version="1.0"?><foo bar="baz"><call>hey</call></foo>)
doc.save(std::cout, "", pugi::format_raw);
diff --git a/docs/samples/text.cpp b/docs/samples/text.cpp
index 9b1cf69..a0d591b 100644
--- a/docs/samples/text.cpp
+++ b/docs/samples/text.cpp
@@ -7,7 +7,7 @@ int main()
pugi::xml_document doc;
// get a test document
- doc.load("<project><name>test</name><version>1.1</version><public>yes</public></project>");
+ doc.load_string("<project><name>test</name><version>1.1</version><public>yes</public></project>");
pugi::xml_node project = doc.child("project");