cerco di risponderti ma non è cosi facile..perche nel porre la questione ho un po semplificato il tutto..visto che ci sono in mezzo 5-6 file.. uno per le strtture list, uno per quelle node, con relative funzioni che creano liste, nodi...etc

cmq nel main attuale:
codice:
int err;
	node t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12;	// t1 è la radice
	char *query1,*query2,*query3;
	list lista_query,risultato;
	int radice;
	err = new_list(&lista_query);
	err = new_list(&risultato);

// costruzione albero di prova input
	err = new_tag_node(&t1, "libro");
            err = new_tag_node(&t2, "categoria");
            err = new_text_node(&t3, "giallo");
	err = new_text_node(&t4, "romanzo");
	err = new_tag_node(&t5, "autore");
	err = new_tag_node(&t6, "nome");
	err = new_tag_node(&t7, "nome");
	err = new_text_node(&t8, "wilbur");
	err = new_text_node(&t9, "smith");
	err = new_text_node(&t10, "\n");	
	err = new_text_node(&t11, "\n");
	err = new_text_node(&t12, "\n");

	err = add_child(t1, t10);
	err = add_child(t1, t2);
	err = add_child(t1, t11);
	err = add_child(t1, t5);
	err = add_child(t1, t12);
	
	err = add_child(t2, t3);
	err = add_child(t2, t4);

	err = add_child(t5, t6);
	err = add_child(t5, t7);
	
	err = add_child(t6, t8);
	err = add_child(t7, t9);
dove le funzioni new_text_node e new_tag_node sono funzioni che appunto creano nodi:
codice:
int new_text_node(node *n, char *text) {
/* crea un nuovo nodo di tipo text */
	node t = malloc(sizeof(struct node));
	t->name = (char *)malloc(sizeof(char) * strlen(text) + 1);
	if (t->name == NULL) return OP_MEM_ERROR;	// errore: mem non allocata
	strcpy(t->name,text);
	t->type = TEXT_NODE;
	int a = new_list(&t->children);
	a = new_list(&t->attributes);
	*n = t;
	return OP_OK;
}
int new_tag_node(node *n, char *text) {
/* crea un nuovo nodo di tipo tag */
	node t = malloc(sizeof(struct node));
	t->name = (char *)malloc(sizeof(char) * strlen(text) + 1);
	if (t->name == NULL) return OP_MEM_ERROR;	// errore: mem non allocata
	strcpy(t->name,text);
	t->type = TAG_NODE;
	int a = new_list(&t->children);
	a = new_list(&t->attributes);
	*n = t;
	return OP_OK;
}
e la add_child:
codice:
int add_child(node parent,node child) {
	if ((!parent) || (!child)) return OP_GENERIC;
	int a;
	a = add_last(&parent->children,&child);
	return 0;
}