diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-05-01 17:11:04 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-05-01 17:11:04 +0000 |
commit | f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54 (patch) | |
tree | 53cec4864776e07950e3c72f2a990a1017d08045 /src/test/xmlwritetest.cpp | |
download | libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.gz libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.bz2 libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.xz libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.zip |
libbu++ is finally laid out the way it should be, trunk, branches, and tags.
Diffstat (limited to '')
-rw-r--r-- | src/test/xmlwritetest.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/xmlwritetest.cpp b/src/test/xmlwritetest.cpp new file mode 100644 index 0000000..340c9a3 --- /dev/null +++ b/src/test/xmlwritetest.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | #include "xmlfilewriter.h" | ||
2 | #include "xmlstringwriter.h" | ||
3 | |||
4 | void fillItIn( XmlWriter &w ) | ||
5 | { | ||
6 | w.addNode("thinglist"); | ||
7 | |||
8 | w.addNode("thing"); | ||
9 | w.addProperty("type", "Weapon"); | ||
10 | |||
11 | w.addNode("id", "Klophin Staff", true ); | ||
12 | w.addNode("name", "Klophin Staff", true ); | ||
13 | w.addNode("durability", "0.01", true ); | ||
14 | w.addNode("size", "0.1", true ); | ||
15 | |||
16 | w.addNode("config"); | ||
17 | w.addNode("damage", "3d6+4", true ); | ||
18 | w.addNode("class", "melee", true ); | ||
19 | w.addNode("type", "bludgeon", true ); | ||
20 | w.addNode("damagedesc", "club/clubs", true ); | ||
21 | w.closeNode(); | ||
22 | |||
23 | w.closeNode(); | ||
24 | |||
25 | w.closeNode(); | ||
26 | } | ||
27 | |||
28 | int main() | ||
29 | { | ||
30 | printf("Testing XmlWriter...\n"); | ||
31 | XmlFileWriter wf("test.xml", "\t"); | ||
32 | |||
33 | fillItIn( wf ); | ||
34 | |||
35 | XmlStringWriter ws("\t"); | ||
36 | fillItIn( ws ); | ||
37 | |||
38 | printf("Now the string version:\n\n%s\n", ws.getString().c_str() ); | ||
39 | |||
40 | return 0; | ||
41 | } | ||