"wrappers/python/src/vscode:/vscode.git/clone" did not exist on "681ab7ffc63bf928cf2ac385b631fc22defe5052"
test.cpp 938 Bytes
Newer Older
Peter Eastman's avatar
Peter Eastman committed
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
#include <irrXML.h>
using namespace irr;
using namespace io;

#include <string> // we use STL strings to store data in this example

int main()
{
	IrrXMLReader* xml = createIrrXMLReader("config.xml");

	// strings for storing the data we want to get out of the file
	std::string modelFile;
	std::string messageText;
	std::string caption;

	// parse the file until end reached
	while(xml && xml->read())
	{
		switch(xml->getNodeType())
		{
		case EXN_TEXT:
			// in this xml file, the only text which occurs is the messageText
			messageText = xml->getNodeData();
			break;
		case EXN_ELEMENT:
			{
				if (!strcmp("startUpModel", xml->getNodeName()))
					modelFile = xml->getAttributeValue("file");
				else
				if (!strcmp("messageText", xml->getNodeName()))
					caption = xml->getAttributeValue("caption");
			}
			break;
		}
	}

	// delete the xml parser after usage
	delete xml;
	return 0;
}