1 #include "tinyxml/tinyxml.h"
2 #include "../include/pnd_pxml.h"
6 void pnd_pxml_load(const char* pFilename, pnd_pxml_t *app)
9 TiXmlDocument doc(pFilename);
10 if (!doc.LoadFile()) return;
12 TiXmlHandle hDoc(&doc);
16 pElem=hDoc.FirstChildElement().Element();
18 hRoot=TiXmlHandle(pElem);
20 pElem = hRoot.FirstChild( "title" ).FirstChildElement("en").Element();
23 app->title_en = strdup(pElem->GetText());
26 pElem = hRoot.FirstChild( "title" ).FirstChildElement("de").Element();
29 app->title_de = strdup(pElem->GetText());
32 pElem = hRoot.FirstChild( "title" ).FirstChildElement("it").Element();
35 app->title_it = strdup(pElem->GetText());
38 pElem = hRoot.FirstChild( "title" ).FirstChildElement("fr").Element();
41 app->title_fr = strdup(pElem->GetText());
44 pElem=hRoot.FirstChild("unique_id").Element();
47 app->unique_id = strdup(pElem->GetText());
50 pElem=hRoot.FirstChild("standalone").Element();
53 app->standalone = strdup(pElem->GetText());
56 pElem=hRoot.FirstChild("icon").Element();
59 char anotherbuffer [ FILENAME_MAX ];
60 strcpy ( anotherbuffer, pFilename );
61 char *s = strstr ( anotherbuffer, PXML_FILENAME );
62 strcpy ( s, strdup(pElem->GetText()));
63 app->icon = strdup(anotherbuffer);
66 pElem = hRoot.FirstChild( "description" ).FirstChildElement("en").Element();
69 app->description_en = strdup(pElem->GetText());
72 pElem = hRoot.FirstChild( "description" ).FirstChildElement("de").Element();
75 app->description_de = strdup(pElem->GetText());
78 pElem = hRoot.FirstChild( "description" ).FirstChildElement("it").Element();
81 app->description_it = strdup(pElem->GetText());
84 pElem = hRoot.FirstChild( "description" ).FirstChildElement("fr").Element();
87 app->description_fr = strdup(pElem->GetText());
90 pElem = hRoot.FirstChild( "previewpic" ).FirstChildElement("pic1").Element();
93 app->previewpic1 = strdup(pElem->GetText());
96 pElem = hRoot.FirstChild( "previewpic" ).FirstChildElement("pic2").Element();
99 app->previewpic2 = strdup(pElem->GetText());
102 pElem = hRoot.FirstChild( "author" ).FirstChildElement("name").Element();
105 app->author_name = strdup(pElem->GetText());
108 pElem = hRoot.FirstChild( "author" ).FirstChildElement("website").Element();
111 app->author_website = strdup(pElem->GetText());;
114 pElem = hRoot.FirstChild( "version" ).FirstChildElement("major").Element();
117 app->version_major = strdup(pElem->GetText());
120 pElem = hRoot.FirstChild( "version" ).FirstChildElement("minor").Element();
123 app->version_minor = strdup(pElem->GetText());
126 pElem = hRoot.FirstChild( "version" ).FirstChildElement("release").Element();
129 app->version_release = strdup(pElem->GetText());
132 pElem = hRoot.FirstChild( "version" ).FirstChildElement("build").Element();
135 app->version_build = strdup(pElem->GetText());
138 pElem=hRoot.FirstChild("exec").Element();
141 char anotherbuffer [ FILENAME_MAX ];
142 strcpy ( anotherbuffer, pFilename );
143 char *s = strstr ( anotherbuffer, PXML_FILENAME );
144 strcpy ( s, strdup(pElem->GetText()));
145 app->exec = strdup(anotherbuffer);
148 pElem = hRoot.FirstChild( "category" ).FirstChildElement("main").Element();
151 app->main_category = strdup(pElem->GetText());
154 pElem = hRoot.FirstChild( "category" ).FirstChildElement("subcategory1").Element();
157 app->subcategory1 = strdup(pElem->GetText());
160 pElem = hRoot.FirstChild( "category" ).FirstChildElement("subcategory2").Element();
163 app->subcategory2 = strdup(pElem->GetText());
166 pElem = hRoot.FirstChild( "altcategory" ).FirstChildElement("main").Element();
169 app->altcategory = strdup(pElem->GetText());
172 pElem = hRoot.FirstChild( "altcategory" ).FirstChildElement("subcategory1").Element();
175 app->altsubcategory1 = strdup(pElem->GetText());
178 pElem = hRoot.FirstChild( "altcategory" ).FirstChildElement("subcategory2").Element();
181 app->altsubcategory2 = strdup(pElem->GetText());
184 pElem = hRoot.FirstChild( "osversion" ).FirstChildElement("major").Element();
187 app->osversion_major = strdup(pElem->GetText());
190 pElem = hRoot.FirstChild( "osversion" ).FirstChildElement("minor").Element();
193 app->osversion_minor = strdup(pElem->GetText());
196 pElem = hRoot.FirstChild( "osversion" ).FirstChildElement("release").Element();
199 app->osversion_release = strdup(pElem->GetText());
202 pElem = hRoot.FirstChild( "osversion" ).FirstChildElement("build").Element();
205 app->osversion_build = strdup(pElem->GetText());
208 pElem = hRoot.FirstChild( "associationitem1" ).FirstChildElement("name").Element();
211 app->associationitem1_name = strdup(pElem->GetText());
214 pElem = hRoot.FirstChild( "associationitem1" ).FirstChildElement("filetype").Element();
217 app->associationitem1_filetype = strdup(pElem->GetText());
220 pElem = hRoot.FirstChild( "associationitem1" ).FirstChildElement("parameter").Element();
223 app->associationitem1_parameter = strdup(pElem->GetText());
226 pElem = hRoot.FirstChild( "associationitem2" ).FirstChildElement("name").Element();
229 app->associationitem2_name = strdup(pElem->GetText());
232 pElem = hRoot.FirstChild( "associationitem2" ).FirstChildElement("filetype").Element();
235 app->associationitem2_filetype = strdup(pElem->GetText());
238 pElem = hRoot.FirstChild( "associationitem2" ).FirstChildElement("parameter").Element();
241 app->associationitem2_parameter = strdup(pElem->GetText());
244 pElem = hRoot.FirstChild( "associationitem3" ).FirstChildElement("name").Element();
247 app->associationitem3_name = strdup(pElem->GetText());
250 pElem = hRoot.FirstChild( "associationitem3" ).FirstChildElement("filetype").Element();
253 app->associationitem3_filetype = strdup(pElem->GetText());
256 pElem = hRoot.FirstChild( "associationitem3" ).FirstChildElement("parameter").Element();
259 app->associationitem3_parameter = strdup(pElem->GetText());
262 pElem=hRoot.FirstChild("clockspeed").Element();
265 app->clockspeed = strdup(pElem->GetText());
268 pElem=hRoot.FirstChild("background").Element();
271 app->background = strdup(pElem->GetText());
274 pElem=hRoot.FirstChild("startdir").Element();
277 app->startdir = strdup(pElem->GetText());