From 7d24b9b5655d584b6dc8b89df7cbd58d2e940a81 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Mon, 19 Jul 2010 09:57:32 +0000 Subject: Set svn:eol-style to native for all text files git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640 --- docs/samples/modify_base.cpp | 86 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'docs/samples/modify_base.cpp') diff --git a/docs/samples/modify_base.cpp b/docs/samples/modify_base.cpp index 7d52bd1..7d0959a 100644 --- a/docs/samples/modify_base.cpp +++ b/docs/samples/modify_base.cpp @@ -1,43 +1,43 @@ -#include "pugixml.hpp" - -#include -#include - -int main() -{ - pugi::xml_document doc; - if (!doc.load("text", pugi::parse_default | pugi::parse_comments)) return -1; - - //[code_modify_base_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 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; - //] - - //[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; - - // 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; - //] -} - -// vim:et +#include "pugixml.hpp" + +#include +#include + +int main() +{ + pugi::xml_document doc; + if (!doc.load("text", pugi::parse_default | pugi::parse_comments)) return -1; + + //[code_modify_base_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 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; + //] + + //[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; + + // 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; + //] +} + +// vim:et -- cgit v1.2.3