1 #include "tinyxml/tinyxml.h"
5 const char *key_collection
= "collection";
6 const char *key_package
= "package";
7 const char *key_name
= "name";
8 const char *key_version
= "version";
9 const char *key_group
= "group";
10 const char *key_description
= "description";
11 const char *key_title
= "title";
12 const char *key_release
= "release";
13 const char *key_file
= "file";
19 load_collection_file(const char *name
)
23 collection_t
*collection
= NULL
;
26 col
= doc
.FirstChildElement(key_collection
);
32 collection
= (collection_t
*) malloc(sizeof(collection_t
));
33 INIT_LIST_HEAD(&collection
->packages
);
35 xmlpkg
= col
->FirstChildElement(key_package
);
41 pkg
= (package_t
*) malloc(sizeof(package_t
));
43 INIT_LIST_HEAD(&pkg
->file_list
);
45 pkg
->id
= package_id
++;
46 pkg
->name
= strdup(xmlpkg
->Attribute(key_name
));
47 pkg
->version
= strdup(xmlpkg
->Attribute(key_version
));
48 pkg
->group
= strdup(xmlpkg
->Attribute(key_group
));
50 xmle
= xmlpkg
->FirstChildElement(key_description
);
51 pkg
->description
= strdup(xmle
->Attribute(key_title
));
53 xmle
= xmlpkg
->FirstChildElement(key_release
);
54 pkg
->filename
= strdup(xmle
->Attribute(key_file
));
56 list_add_tail(&pkg
->list
, &collection
->packages
);
57 xmlpkg
= xmlpkg
->NextSiblingElement();