1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "xmlfilewriter.h"
#include "xmlstringwriter.h"
void fillItIn( XmlWriter &w )
{
w.addNode("thinglist");
w.addNode("thing");
w.addProperty("type", "Weapon");
w.addNode("id", "Klophin Staff", true );
w.addNode("name", "Klophin Staff", true );
w.addNode("durability", "0.01", true );
w.addNode("size", "0.1", true );
w.addNode("config");
w.addNode("damage", "3d6+4", true );
w.addNode("class", "melee", true );
w.addNode("type", "bludgeon", true );
w.addNode("damagedesc", "club/clubs", true );
w.closeNode();
w.closeNode();
w.closeNode();
}
int main()
{
printf("Testing XmlWriter...\n");
XmlFileWriter wf("test.xml", "\t");
fillItIn( wf );
XmlStringWriter ws("\t");
fillItIn( ws );
printf("Now the string version:\n\n%s\n", ws.getString().c_str() );
return 0;
}
|