mxml_find_nodes1 able to analyze e.g. [name='XX'][2]

This commit is contained in:
Matthias Schneebeli
2006-03-07 15:06:59 +00:00
parent 0ca44a6d92
commit 29adc0b8f9
+9 -4
View File
@@ -731,7 +731,7 @@ int mxml_find_nodes1(PMXML_NODE tree, char *xml_path, PMXML_NODE **nodelist, int
char cond_name[MXML_MAX_CONDITION][256], cond_value[MXML_MAX_CONDITION][256];
int cond_type[MXML_MAX_CONDITION];
int i, j, k, index, num_cond;
int cond_satisfied;
int cond_satisfied,cond_index;
size_t len;
p1 = xml_path;
@@ -808,6 +808,7 @@ int mxml_find_nodes1(PMXML_NODE tree, char *xml_path, PMXML_NODE **nodelist, int
}
}
cond_index = 0;
for (i=j=0 ; i<pnode->n_children ; i++) {
if (num_cond) {
cond_satisfied = 0;
@@ -827,9 +828,13 @@ int mxml_find_nodes1(PMXML_NODE tree, char *xml_path, PMXML_NODE **nodelist, int
cond_satisfied++;
}
}
if (cond_satisfied==num_cond)
if (!mxml_add_resultnode(pnode->child+i, p2, nodelist, found))
return 0;
if (cond_satisfied==num_cond) {
cond_index++;
if (index == 0 || cond_index == index) {
if (!mxml_add_resultnode(pnode->child+i, p2, nodelist, found))
return 0;
}
}
} else {
if (strcmp(pnode->child[i].name, node_name) == 0)
if (index == 0 || ++j == index)