diff options
Diffstat (limited to 'example.cpp')
| -rw-r--r-- | example.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/example.cpp b/example.cpp index fa1574c..bbc3bbd 100644 --- a/example.cpp +++ b/example.cpp @@ -22,27 +22,29 @@ * 3. This notice may not be removed or altered from any source * distribution. */ - + #include <iostream> #include "sxml.h" using sxml::element; - +using sxml::comment; int main() { - element root("summary"); - - root.add_child(element("foo", "lorem ipsum")) - - .add_child(element("bar") - .add_child(element("foobar", "bazinga!")) - .set_attr("id", "1337")) - - .add_child(element("mother").add_child(element("child"))); - - std::cout << root.to_string(true) << std::endl; - + element *root = new element("root"); + + root->add_element("node")->set_attr("id", 0); + + root->add_child(new comment("yay, a comment!")); + root->add_element("node")->set_attr("id", 1); + + element *node = root->add_element("node")->set_attr("id", 3.1); + node = node->add_element("subnode") + node->add_element("subsubnode")->add_child( + new comment("i am in pretty deep waters here, man ..")); + + std::cout << root->to_string(true) << std::endl; + return 0; } |
