headerlist.c: remove temporary code used for debugging with libxml2

This commit is contained in:
Silvan Calarco 2021-02-16 16:03:09 +01:00
parent c0c8df638e
commit 3d6d78539c

View File

@ -743,46 +743,6 @@ void cleanRepodata(struct repoData *repodata) {
free(repodata); free(repodata);
} }
/**
* print_element_names:
* @a_node: the initial xml node to consider.
*
* Prints the names of the all the xml elements
* that are siblings or children of a given xml node.
*/
static void
print_element_names(xmlNode * a_node, int level)
{
xmlNode *cur_node = NULL;
char *str = malloc(level + 1);
char *ptr = str;
for (int i=0; i < level; i++) {
*ptr ++ = ' ';
}
*ptr = 0;
for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
if (cur_node->children && cur_node->children->content)
printf("%snode type: Element, name: %s, content: %s\n", str,
cur_node->name, XML_GET_CONTENT(cur_node->children));
else
printf("%snode type: Element, name: %s\n", str, cur_node->name);
if (cur_node->properties) {
xmlAttr* attribute = cur_node->properties;
while(attribute && attribute->name && attribute->children)
{
xmlChar* value = xmlNodeListGetString(cur_node->doc, attribute->children, 1);
printf ("%s | attribute %s: %s\n", str, attribute->name, value);
xmlFree(value);
attribute = attribute->next;
}
}
}
print_element_names(cur_node->children, level + 1);
}
}
xmlChar* findXMLAttributeByName(xmlNode *node, char* name) { xmlChar* findXMLAttributeByName(xmlNode *node, char* name) {
xmlAttr* attribute = node->properties; xmlAttr* attribute = node->properties;
while(attribute && attribute->name && attribute->children) while(attribute && attribute->name && attribute->children)
@ -1056,8 +1016,6 @@ int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) {
} }
if (repodata) { if (repodata) {
// Use repodata // Use repodata
//n = atoi((char*)findXMLPropertyByName(xmlDocGetRootElement(repodata->primary_doc), "packages"));
//xmlNode* packageNode = findXMLPackageByName(xmlDocGetRootElement(repodata->other_doc), "firefox");
xmlNode *filelists_node = xmlDocGetRootElement(repodata->filelists_doc)->children; xmlNode *filelists_node = xmlDocGetRootElement(repodata->filelists_doc)->children;
xmlNode *other_node = xmlDocGetRootElement(repodata->other_doc)->children; xmlNode *other_node = xmlDocGetRootElement(repodata->other_doc)->children;
for (xmlNode *package_node = xmlDocGetRootElement(repodata->primary_doc)->children; for (xmlNode *package_node = xmlDocGetRootElement(repodata->primary_doc)->children;
@ -1066,7 +1024,6 @@ int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) {
filelists_node = filelists_node->next, filelists_node = filelists_node->next,
other_node = other_node->next) { other_node = other_node->next) {
if (!strcmp((char*)package_node->name, "package")) { if (!strcmp((char*)package_node->name, "package")) {
//print_element_names(package_node->children, 0);
newheadersourcelist = malloc(sizeof(struct headerSourceList)); newheadersourcelist = malloc(sizeof(struct headerSourceList));
if (newheadersourcelist == NULL) return 1; if (newheadersourcelist == NULL) return 1;