summaryrefslogtreecommitdiff
path: root/docs/samples
diff options
context:
space:
mode:
Diffstat (limited to 'docs/samples')
-rw-r--r--docs/samples/custom_memory_management.cpp8
-rw-r--r--docs/samples/include.cpp4
-rw-r--r--docs/samples/load_error_handling.cpp6
-rw-r--r--docs/samples/load_file.cpp4
-rw-r--r--docs/samples/load_memory.cpp25
-rw-r--r--docs/samples/load_options.cpp4
-rw-r--r--docs/samples/load_stream.cpp4
-rw-r--r--docs/samples/modify_add.cpp4
-rw-r--r--docs/samples/modify_base.cpp8
-rw-r--r--docs/samples/modify_remove.cpp4
-rw-r--r--docs/samples/save_custom_writer.cpp4
-rw-r--r--docs/samples/save_declaration.cpp4
-rw-r--r--docs/samples/save_file.cpp4
-rw-r--r--docs/samples/save_options.cpp4
-rw-r--r--docs/samples/save_stream.cpp4
-rw-r--r--docs/samples/save_subtree.cpp4
-rw-r--r--docs/samples/text.cpp8
-rw-r--r--docs/samples/traverse_base.cpp12
-rw-r--r--docs/samples/traverse_iter.cpp4
-rw-r--r--docs/samples/traverse_predicate.cpp8
-rw-r--r--docs/samples/traverse_rangefor.cpp64
-rw-r--r--docs/samples/traverse_walker.cpp8
-rw-r--r--docs/samples/xpath_error.cpp4
-rw-r--r--docs/samples/xpath_query.cpp4
-rw-r--r--docs/samples/xpath_select.cpp4
-rw-r--r--docs/samples/xpath_variables.cpp4
26 files changed, 109 insertions, 106 deletions
diff --git a/docs/samples/custom_memory_management.cpp b/docs/samples/custom_memory_management.cpp
index f11d27e..2cb5520 100644
--- a/docs/samples/custom_memory_management.cpp
+++ b/docs/samples/custom_memory_management.cpp
@@ -2,7 +2,7 @@
#include <new>
-//[code_custom_memory_management_decl
+// tag::decl[]
void* custom_allocate(size_t size)
{
return new (std::nothrow) char[size];
@@ -12,13 +12,13 @@ void custom_deallocate(void* ptr)
{
delete[] static_cast<char*>(ptr);
}
-//]
+// end::decl[]
int main()
{
-//[code_custom_memory_management_call
+// tag::call[]
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);
-//]
+// end::call[]
pugi::xml_document doc;
doc.load_string("<node/>");
diff --git a/docs/samples/include.cpp b/docs/samples/include.cpp
index fa615a4..39830c5 100644
--- a/docs/samples/include.cpp
+++ b/docs/samples/include.cpp
@@ -3,7 +3,7 @@
#include <string.h>
#include <iostream>
-//[code_include
+// tag::code[]
bool load_preprocess(pugi::xml_document& doc, const char* path);
bool preprocess(pugi::xml_node node)
@@ -51,7 +51,7 @@ bool load_preprocess(pugi::xml_document& doc, const char* path)
return result ? preprocess(doc) : false;
}
-//]
+// end::code[]
int main()
{
diff --git a/docs/samples/load_error_handling.cpp b/docs/samples/load_error_handling.cpp
index 8dceb99..d1e5a49 100644
--- a/docs/samples/load_error_handling.cpp
+++ b/docs/samples/load_error_handling.cpp
@@ -4,19 +4,21 @@
void check_xml(const char* source)
{
-//[code_load_error_handling
+// tag::code[]
pugi::xml_document doc;
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";
+ }
else
{
std::cout << "XML [" << source << "] parsed with errors, attr value: [" << doc.child("node").attribute("attr").value() << "]\n";
std::cout << "Error description: " << result.description() << "\n";
std::cout << "Error offset: " << result.offset << " (error at [..." << (source + result.offset) << "]\n\n";
}
-//]
+// end::code[]
}
int main()
diff --git a/docs/samples/load_file.cpp b/docs/samples/load_file.cpp
index f7b06c9..8b2191b 100644
--- a/docs/samples/load_file.cpp
+++ b/docs/samples/load_file.cpp
@@ -4,13 +4,13 @@
int main()
{
-//[code_load_file
+// tag::code[]
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file("tree.xml");
std::cout << "Load result: " << result.description() << ", mesh name: " << doc.child("mesh").attribute("name").value() << std::endl;
-//]
+// end::code[]
}
// vim:et
diff --git a/docs/samples/load_memory.cpp b/docs/samples/load_memory.cpp
index 490f7e4..80bba3c 100644
--- a/docs/samples/load_memory.cpp
+++ b/docs/samples/load_memory.cpp
@@ -5,41 +5,42 @@
int main()
{
-//[code_load_memory_decl
+// tag::decl[]
const char source[] = "<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>";
size_t size = sizeof(source);
-//]
+// end::decl[]
pugi::xml_document doc;
{
- //[code_load_memory_buffer
+ // tag::load_buffer[]
// You can use load_buffer to load document from immutable memory block:
pugi::xml_parse_result result = doc.load_buffer(source, size);
- //]
+ // end::load_buffer[]
std::cout << "Load result: " << result.description() << ", mesh name: " << doc.child("mesh").attribute("name").value() << std::endl;
}
{
- //[code_load_memory_buffer_inplace
+ // tag::load_buffer_inplace_begin[]
// You can use load_buffer_inplace to load document from mutable memory block; the block's lifetime must exceed that of document
char* buffer = new char[size];
memcpy(buffer, source, size);
// The block can be allocated by any method; the block is modified during parsing
pugi::xml_parse_result result = doc.load_buffer_inplace(buffer, size);
+ // end::load_buffer_inplace_begin[]
- //<-
std::cout << "Load result: " << result.description() << ", mesh name: " << doc.child("mesh").attribute("name").value() << std::endl;
- //->
+
+ // tag::load_buffer_inplace_end[]
// You have to destroy the block yourself after the document is no longer used
delete[] buffer;
- //]
+ // end::load_buffer_inplace_end[]
}
{
- //[code_load_memory_buffer_inplace_own
+ // tag::load_buffer_inplace_own[]
// You can use load_buffer_inplace_own to load document from mutable memory block and to pass the ownership of this block
// The block has to be allocated via pugixml allocation function - using i.e. operator new here is incorrect
char* buffer = static_cast<char*>(pugi::get_memory_allocation_function()(size));
@@ -47,16 +48,16 @@ int main()
// The block will be deleted by the document
pugi::xml_parse_result result = doc.load_buffer_inplace_own(buffer, size);
- //]
+ // end::load_buffer_inplace_own[]
std::cout << "Load result: " << result.description() << ", mesh name: " << doc.child("mesh").attribute("name").value() << std::endl;
}
{
- //[code_load_memory_string
+ // tag::load_string[]
// You can use load to load document from null-terminated strings, for example literals:
pugi::xml_parse_result result = doc.load_string("<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>");
- //]
+ // end::load_string[]
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 2589348..b7b0a6b 100644
--- a/docs/samples/load_options.cpp
+++ b/docs/samples/load_options.cpp
@@ -6,7 +6,7 @@ int main()
{
pugi::xml_document doc;
-//[code_load_options
+// tag::code[]
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
@@ -24,7 +24,7 @@ int main()
// Parsing with minimal option mask; comment node is not added to the tree, and &lt; is not expanded
doc.load_string(source, pugi::parse_minimal);
std::cout << "First node value: [" << doc.first_child().value() << "], node child value: [" << doc.child_value("node") << "]\n";
-//]
+// end::code[]
}
// vim:et
diff --git a/docs/samples/load_stream.cpp b/docs/samples/load_stream.cpp
index 05cfb7f..f982a83 100644
--- a/docs/samples/load_stream.cpp
+++ b/docs/samples/load_stream.cpp
@@ -33,10 +33,10 @@ int main()
pugi::xml_document doc;
{
- //[code_load_stream
+ // tag::code[]
std::ifstream stream("weekly-utf-8.xml");
pugi::xml_parse_result result = doc.load(stream);
- //]
+ // end::code[]
// first character of root name: U+9031, year: 1997
print_doc("UTF8 file from narrow stream", doc, result);
diff --git a/docs/samples/modify_add.cpp b/docs/samples/modify_add.cpp
index 04ab445..a2ddd31 100644
--- a/docs/samples/modify_add.cpp
+++ b/docs/samples/modify_add.cpp
@@ -6,7 +6,7 @@ int main()
{
pugi::xml_document doc;
- //[code_modify_add
+ // tag::code[]
// add node with some name
pugi::xml_node node = doc.append_child("node");
@@ -21,7 +21,7 @@ int main()
param.append_attribute("name") = "version";
param.append_attribute("value") = 1.1;
param.insert_attribute_after("type", param.attribute("name")) = "float";
- //]
+ // end::code[]
doc.print(std::cout);
}
diff --git a/docs/samples/modify_base.cpp b/docs/samples/modify_base.cpp
index bd63708..7c4819b 100644
--- a/docs/samples/modify_base.cpp
+++ b/docs/samples/modify_base.cpp
@@ -8,7 +8,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_string("<node id='123'>text</node><!-- comment -->", pugi::parse_default | pugi::parse_comments)) return -1;
- //[code_modify_base_node
+ // tag::node[]
pugi::xml_node node = doc.child("node");
// change node name
@@ -21,9 +21,9 @@ int main()
// we can't change value of the element or name of the comment
std::cout << node.set_value("1") << ", " << doc.last_child().set_name("2") << std::endl;
- //]
+ // end::node[]
- //[code_modify_base_attr
+ // tag::attr[]
pugi::xml_attribute attr = node.attribute("id");
// change attribute name/value
@@ -37,7 +37,7 @@ int main()
// we can also use assignment operators for more concise code
attr = true;
std::cout << "final attribute value: " << attr.value() << std::endl;
- //]
+ // end::attr[]
}
// vim:et
diff --git a/docs/samples/modify_remove.cpp b/docs/samples/modify_remove.cpp
index 53020e1..d54c0d8 100644
--- a/docs/samples/modify_remove.cpp
+++ b/docs/samples/modify_remove.cpp
@@ -7,7 +7,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_string("<node><description>Simple node</description><param name='id' value='123'/></node>")) return -1;
- //[code_modify_remove
+ // tag::code[]
// remove description node with the whole subtree
pugi::xml_node node = doc.child("node");
node.remove_child("description");
@@ -19,7 +19,7 @@ int main()
// we can also remove nodes/attributes by handles
pugi::xml_attribute id = param.attribute("name");
param.remove_attribute(id);
- //]
+ // end::code[]
doc.print(std::cout);
}
diff --git a/docs/samples/save_custom_writer.cpp b/docs/samples/save_custom_writer.cpp
index fe08b72..e777a32 100644
--- a/docs/samples/save_custom_writer.cpp
+++ b/docs/samples/save_custom_writer.cpp
@@ -4,7 +4,7 @@
#include <iostream>
#include <cstring>
-//[code_save_custom_writer
+// tag::code[]
struct xml_string_writer: pugi::xml_writer
{
std::string result;
@@ -14,7 +14,7 @@ struct xml_string_writer: pugi::xml_writer
result.append(static_cast<const char*>(data), size);
}
};
-//]
+// end::code[]
struct xml_memory_writer: pugi::xml_writer
{
diff --git a/docs/samples/save_declaration.cpp b/docs/samples/save_declaration.cpp
index a45831f..0d54782 100644
--- a/docs/samples/save_declaration.cpp
+++ b/docs/samples/save_declaration.cpp
@@ -4,7 +4,7 @@
int main()
{
- //[code_save_declaration
+ // tag::code[]
// get a test document
pugi::xml_document doc;
doc.load_string("<foo bar='baz'><call>hey</call></foo>");
@@ -21,7 +21,7 @@ int main()
// </foo>
doc.save(std::cout);
std::cout << std::endl;
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/save_file.cpp b/docs/samples/save_file.cpp
index 21413a2..10c6104 100644
--- a/docs/samples/save_file.cpp
+++ b/docs/samples/save_file.cpp
@@ -8,10 +8,10 @@ int main()
pugi::xml_document doc;
doc.load_string("<foo bar='baz'>hey</foo>");
- //[code_save_file
+ // tag::code[]
// save document to file
std::cout << "Saving result: " << doc.save_file("save_file_output.xml") << std::endl;
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/save_options.cpp b/docs/samples/save_options.cpp
index 82abdcd..e196946 100644
--- a/docs/samples/save_options.cpp
+++ b/docs/samples/save_options.cpp
@@ -4,7 +4,7 @@
int main()
{
- //[code_save_options
+ // tag::code[]
// get a test document
pugi::xml_document doc;
doc.load_string("<foo bar='baz'><call>hey</call></foo>");
@@ -42,7 +42,7 @@ int main()
// <foo bar="baz"><call>hey</call></foo>
doc.save(std::cout, "\t", pugi::format_raw | pugi::format_no_declaration);
std::cout << std::endl;
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/save_stream.cpp b/docs/samples/save_stream.cpp
index eba1863..84a33bf 100644
--- a/docs/samples/save_stream.cpp
+++ b/docs/samples/save_stream.cpp
@@ -8,11 +8,11 @@ int main()
pugi::xml_document doc;
doc.load_string("<foo bar='baz'><call>hey</call></foo>");
- //[code_save_stream
+ // tag::code[]
// save document to standard output
std::cout << "Document:\n";
doc.save(std::cout);
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/save_subtree.cpp b/docs/samples/save_subtree.cpp
index a94e10a..5ae4830 100644
--- a/docs/samples/save_subtree.cpp
+++ b/docs/samples/save_subtree.cpp
@@ -4,7 +4,7 @@
int main()
{
- //[code_save_subtree
+ // tag::code[]
// get a test document
pugi::xml_document doc;
doc.load_string("<foo bar='baz'><call>hey</call></foo>");
@@ -20,7 +20,7 @@ int main()
// print a subtree to standard output (prints <call>hey</call>)
doc.child("foo").child("call").print(std::cout, "", pugi::format_raw);
std::cout << std::endl;
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/text.cpp b/docs/samples/text.cpp
index a0d591b..db577bc 100644
--- a/docs/samples/text.cpp
+++ b/docs/samples/text.cpp
@@ -11,23 +11,23 @@ int main()
pugi::xml_node project = doc.child("project");
- //[code_text_access
+ // tag::access[]
std::cout << "Project name: " << project.child("name").text().get() << std::endl;
std::cout << "Project version: " << project.child("version").text().as_double() << std::endl;
std::cout << "Project visibility: " << (project.child("public").text().as_bool(/* def= */ true) ? "public" : "private") << std::endl;
std::cout << "Project description: " << project.child("description").text().get() << std::endl;
- //]
+ // end::access[]
std::cout << std::endl;
- //[code_text_modify
+ // tag::modify[]
// change project version
project.child("version").text() = 1.2;
// add description element and set the contents
// note that we do not have to explicitly add the node_pcdata child
project.append_child("description").text().set("a test project");
- //]
+ // end::modify[]
doc.save(std::cout);
}
diff --git a/docs/samples/traverse_base.cpp b/docs/samples/traverse_base.cpp
index d59c8b0..3ee7fe4 100644
--- a/docs/samples/traverse_base.cpp
+++ b/docs/samples/traverse_base.cpp
@@ -10,7 +10,7 @@ int main()
pugi::xml_node tools = doc.child("Profile").child("Tools");
- //[code_traverse_base_basic
+ // tag::basic[]
for (pugi::xml_node tool = tools.first_child(); tool; tool = tool.next_sibling())
{
std::cout << "Tool:";
@@ -22,11 +22,11 @@ int main()
std::cout << std::endl;
}
- //]
+ // end::basic[]
std::cout << std::endl;
- //[code_traverse_base_data
+ // tag::data[]
for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling("Tool"))
{
std::cout << "Tool " << tool.attribute("Filename").value();
@@ -34,18 +34,18 @@ int main()
std::cout << ", Timeout " << tool.attribute("Timeout").as_int();
std::cout << ", Description '" << tool.child_value("Description") << "'\n";
}
- //]
+ // end::data[]
std::cout << std::endl;
- //[code_traverse_base_contents
+ // tag::contents[]
std::cout << "Tool for *.dae generation: " << tools.find_child_by_attribute("Tool", "OutputFileMasks", "*.dae").attribute("Filename").value() << "\n";
for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling("Tool"))
{
std::cout << "Tool " << tool.attribute("Filename").value() << "\n";
}
- //]
+ // end::contents[]
}
// vim:et
diff --git a/docs/samples/traverse_iter.cpp b/docs/samples/traverse_iter.cpp
index 90e0dc6..77bcf35 100644
--- a/docs/samples/traverse_iter.cpp
+++ b/docs/samples/traverse_iter.cpp
@@ -9,7 +9,7 @@ int main()
pugi::xml_node tools = doc.child("Profile").child("Tools");
- //[code_traverse_iter
+ // tag::code[]
for (pugi::xml_node_iterator it = tools.begin(); it != tools.end(); ++it)
{
std::cout << "Tool:";
@@ -21,7 +21,7 @@ int main()
std::cout << std::endl;
}
- //]
+ // end::code[]
}
// vim:et
diff --git a/docs/samples/traverse_predicate.cpp b/docs/samples/traverse_predicate.cpp
index 9d8ded0..40e1718 100644
--- a/docs/samples/traverse_predicate.cpp
+++ b/docs/samples/traverse_predicate.cpp
@@ -3,7 +3,7 @@
#include <string.h>
#include <iostream>
-//[code_traverse_predicate_decl
+// tag::decl[]
bool small_timeout(pugi::xml_node node)
{
return node.attribute("Timeout").as_int() < 20;
@@ -21,7 +21,7 @@ struct allow_remote_predicate
return node.attribute("AllowRemote").as_bool();
}
};
-//]
+// end::decl[]
int main()
{
@@ -30,7 +30,7 @@ int main()
pugi::xml_node tools = doc.child("Profile").child("Tools");
- //[code_traverse_predicate_find
+ // tag::find[]
// Find child via predicate (looks for direct children only)
std::cout << tools.find_child(allow_remote_predicate()).attribute("Filename").value() << std::endl;
@@ -42,7 +42,7 @@ int main()
// We can use simple functions instead of function objects
std::cout << tools.find_child(small_timeout).attribute("Filename").value() << std::endl;
- //]
+ // end::find[]
}
// vim:et
diff --git a/docs/samples/traverse_rangefor.cpp b/docs/samples/traverse_rangefor.cpp
index 1f7212e..8d9d7d5 100644
--- a/docs/samples/traverse_rangefor.cpp
+++ b/docs/samples/traverse_rangefor.cpp
@@ -1,32 +1,32 @@
-#include "pugixml.hpp"
-
-#include <iostream>
-
-int main()
-{
- pugi::xml_document doc;
- if (!doc.load_file("xgconsole.xml")) return -1;
-
- pugi::xml_node tools = doc.child("Profile").child("Tools");
-
- //[code_traverse_rangefor
- for (pugi::xml_node tool: tools.children("Tool"))
- {
- std::cout << "Tool:";
-
- for (pugi::xml_attribute attr: tool.attributes())
- {
- std::cout << " " << attr.name() << "=" << attr.value();
- }
-
- for (pugi::xml_node child: tool.children())
- {
- std::cout << ", child " << child.name();
- }
-
- std::cout << std::endl;
- }
- //]
-}
-
-// vim:et
+#include "pugixml.hpp"
+
+#include <iostream>
+
+int main()
+{
+ pugi::xml_document doc;
+ if (!doc.load_file("xgconsole.xml")) return -1;
+
+ pugi::xml_node tools = doc.child("Profile").child("Tools");
+
+ // tag::code[]
+ for (pugi::xml_node tool: tools.children("Tool"))
+ {
+ std::cout << "Tool:";
+
+ for (pugi::xml_attribute attr: tool.attributes())
+ {
+ std::cout << " " << attr.name() << "=" << attr.value();
+ }
+
+ for (pugi::xml_node child: tool.children())
+ {
+ std::cout << ", child " << child.name();
+ }
+
+ std::cout << std::endl;
+ }
+ // end::code[]
+}
+
+// vim:et
diff --git a/docs/samples/traverse_walker.cpp b/docs/samples/traverse_walker.cpp
index cb99902..2f4b11b 100644
--- a/docs/samples/traverse_walker.cpp
+++ b/docs/samples/traverse_walker.cpp
@@ -7,7 +7,7 @@ const char* node_types[] =
"null", "document", "element", "pcdata", "cdata", "comment", "pi", "declaration"
};
-//[code_traverse_walker_impl
+// tag::impl[]
struct simple_walker: pugi::xml_tree_walker
{
virtual bool for_each(pugi::xml_node& node)
@@ -19,17 +19,17 @@ struct simple_walker: pugi::xml_tree_walker
return true; // continue traversal
}
};
-//]
+// end::impl[]
int main()
{
pugi::xml_document doc;
if (!doc.load_file("tree.xml")) return -1;
- //[code_traverse_walker_traverse
+ // tag::traverse[]
simple_walker walker;
doc.traverse(walker);
- //]
+ // end::traverse[]
}
// vim:et
diff --git a/docs/samples/xpath_error.cpp b/docs/samples/xpath_error.cpp
index 6cb6f4f..b6dc424 100644
--- a/docs/samples/xpath_error.cpp
+++ b/docs/samples/xpath_error.cpp
@@ -7,7 +7,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_file("xgconsole.xml")) return -1;
-//[code_xpath_error
+// tag::code[]
// Exception is thrown for incorrect query syntax
try
{
@@ -37,7 +37,7 @@ int main()
{
std::cout << "Select failed: " << e.what() << std::endl;
}
-//]
+// end::code[]
}
// vim:et
diff --git a/docs/samples/xpath_query.cpp b/docs/samples/xpath_query.cpp
index c622a9c..857c04c 100644
--- a/docs/samples/xpath_query.cpp
+++ b/docs/samples/xpath_query.cpp
@@ -8,7 +8,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_file("xgconsole.xml")) return -1;
-//[code_xpath_query
+// tag::code[]
// Select nodes via compiled query
pugi::xpath_query query_remote_tools("/Profile/Tools/Tool[@AllowRemote='true']");
@@ -30,7 +30,7 @@ int main()
if (query_name_valid.evaluate_boolean(tool)) std::cout << s << std::endl;
}
-//]
+// end::code[]
}
// vim:et
diff --git a/docs/samples/xpath_select.cpp b/docs/samples/xpath_select.cpp
index 74dad60..f6067a3 100644
--- a/docs/samples/xpath_select.cpp
+++ b/docs/samples/xpath_select.cpp
@@ -7,7 +7,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_file("xgconsole.xml")) return -1;
-//[code_xpath_select
+// tag::code[]
pugi::xpath_node_set tools = doc.select_nodes("/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']");
std::cout << "Tools:\n";
@@ -22,7 +22,7 @@ int main()
if (build_tool)
std::cout << "Build tool: " << build_tool.node().attribute("Filename").value() << "\n";
-//]
+// end::code[]
}
// vim:et
diff --git a/docs/samples/xpath_variables.cpp b/docs/samples/xpath_variables.cpp
index 52313bf..b2d0850 100644
--- a/docs/samples/xpath_variables.cpp
+++ b/docs/samples/xpath_variables.cpp
@@ -8,7 +8,7 @@ int main()
pugi::xml_document doc;
if (!doc.load_file("xgconsole.xml")) return -1;
-//[code_xpath_variables
+// tag::code[]
// Select nodes via compiled query
pugi::xpath_variable_set vars;
vars.add("remote", pugi::xpath_type_boolean);
@@ -32,7 +32,7 @@ int main()
std::cout << "Local tool imm: ";
tools_local_imm[0].node().print(std::cout);
-//]
+// end::code[]
}
// vim:et