mirror of
https://gitea.psi.ch/ELOG/mxml.git
synced 2026-09-09 01:23:22 +00:00
mxml_find_nodes1 able to analyze e.g. [name='XX'][2]
This commit is contained in:
parent
0ca44a6d92
commit
29adc0b8f9
13
mxml.c
13
mxml.c
@ -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];
|
char cond_name[MXML_MAX_CONDITION][256], cond_value[MXML_MAX_CONDITION][256];
|
||||||
int cond_type[MXML_MAX_CONDITION];
|
int cond_type[MXML_MAX_CONDITION];
|
||||||
int i, j, k, index, num_cond;
|
int i, j, k, index, num_cond;
|
||||||
int cond_satisfied;
|
int cond_satisfied,cond_index;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
p1 = xml_path;
|
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++) {
|
for (i=j=0 ; i<pnode->n_children ; i++) {
|
||||||
if (num_cond) {
|
if (num_cond) {
|
||||||
cond_satisfied = 0;
|
cond_satisfied = 0;
|
||||||
@ -827,9 +828,13 @@ int mxml_find_nodes1(PMXML_NODE tree, char *xml_path, PMXML_NODE **nodelist, int
|
|||||||
cond_satisfied++;
|
cond_satisfied++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cond_satisfied==num_cond)
|
if (cond_satisfied==num_cond) {
|
||||||
if (!mxml_add_resultnode(pnode->child+i, p2, nodelist, found))
|
cond_index++;
|
||||||
return 0;
|
if (index == 0 || cond_index == index) {
|
||||||
|
if (!mxml_add_resultnode(pnode->child+i, p2, nodelist, found))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(pnode->child[i].name, node_name) == 0)
|
if (strcmp(pnode->child[i].name, node_name) == 0)
|
||||||
if (index == 0 || ++j == index)
|
if (index == 0 || ++j == index)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user