diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-07-11 13:29:12 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-07-11 13:29:12 +0000 |
commit | fb507ab2d6f9eaa090671e40b582354b16f3821c (patch) | |
tree | 4cf47721ff98432595ea8704e2e8d421d1f3c913 /docs/samples/modify_base.cpp | |
parent | f73df8d06e67f4a1d00b427d752fb0deab11e553 (diff) |
docs: Replaced all tabs with 4 spaces (guaranteed tab size)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@591 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'docs/samples/modify_base.cpp')
-rw-r--r-- | docs/samples/modify_base.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/docs/samples/modify_base.cpp b/docs/samples/modify_base.cpp index 4213cff..7d52bd1 100644 --- a/docs/samples/modify_base.cpp +++ b/docs/samples/modify_base.cpp @@ -5,37 +5,39 @@ int main()
{
- pugi::xml_document doc;
+ pugi::xml_document doc;
if (!doc.load("<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");
+ pugi::xml_node node = doc.child("node");
- // change node name
- std::cout << node.set_name("notnode");
- std::cout << ", new node name: " << node.name() << std::endl;
+ // change node name
+ std::cout << node.set_name("notnode");
+ std::cout << ", new node name: " << node.name() << std::endl;
- // change comment text
- std::cout << doc.last_child().set_value("useless comment");
- std::cout << ", new comment text: " << doc.last_child().value() << std::endl;
+ // change comment text
+ std::cout << doc.last_child().set_value("useless comment");
+ std::cout << ", new comment text: " << doc.last_child().value() << std::endl;
- // 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;
- //]
+ // 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;
+ //]
- //[code_modify_base_attr
- pugi::xml_attribute attr = node.attribute("id");
+ //[code_modify_base_attr
+ pugi::xml_attribute attr = node.attribute("id");
- // change attribute name/value
- std::cout << attr.set_name("key") << ", " << attr.set_value("345");
- std::cout << ", new attribute: " << attr.name() << "=" << attr.value() << std::endl;
+ // change attribute name/value
+ std::cout << attr.set_name("key") << ", " << attr.set_value("345");
+ std::cout << ", new attribute: " << attr.name() << "=" << attr.value() << std::endl;
- // we can use numbers or booleans
- attr.set_value(1.234);
- std::cout << "new attribute value: " << attr.value() << std::endl;
+ // we can use numbers or booleans
+ attr.set_value(1.234);
+ std::cout << "new attribute value: " << attr.value() << std::endl;
- // we can also use assignment operators for more concise code
- attr = true;
- std::cout << "final attribute value: " << attr.value() << std::endl;
- //]
+ // we can also use assignment operators for more concise code
+ attr = true;
+ std::cout << "final attribute value: " << attr.value() << std::endl;
+ //]
}
+
+// vim:et
|