aboutsummaryrefslogtreecommitdiff
path: root/src/tests/xmlwritetest.cpp
blob: a22d19dd77e845e41ab1be22b6ef48297bd4b692 (plain)
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
42
43
44
45
46
47
48
#include "xmlfilewriter.h"
#include "xmlstringwriter.h"
#include "xmlstringreader.h"

void fillItIn( XmlWriter &w )
{
	w.addNode("thinglist");
	
	w.addNode("thing");
	w.addProperty("type", " ±î´<M-F6><M-F6>³¸®°êòì¯");
	
	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");

	//XmlStringReader *xsr = new XmlStringReader("<stuff/>");

	//printf("%08X\n%08X\n%08X\n", xsr, (XmlReader *)xsr, (XmlDocument *)xsr );

	//delete (XmlDocument *)xsr;
	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;
}