source: icGREP/icgrep-devel/icgrep/combine/pugixml/docs/samples/modify_remove.cpp @ 5516

Last change on this file since 5516 was 5516, checked in by faldebey, 21 months ago

added combinatorial testing tool

File size: 678 bytes
Line 
1#include "pugixml.hpp"
2
3#include <iostream>
4
5int main()
6{
7    pugi::xml_document doc;
8    if (!doc.load_string("<node><description>Simple node</description><param name='id' value='123'/></node>")) return -1;
9
10    // tag::code[]
11    // remove description node with the whole subtree
12    pugi::xml_node node = doc.child("node");
13    node.remove_child("description");
14
15    // remove id attribute
16    pugi::xml_node param = node.child("param");
17    param.remove_attribute("value");
18
19    // we can also remove nodes/attributes by handles
20    pugi::xml_attribute id = param.attribute("name");
21    param.remove_attribute(id);
22    // end::code[]
23
24    doc.print(std::cout);
25}
26
27// vim:et
Note: See TracBrowser for help on using the repository browser.