Reputation: 105
for example:
<something>
<x/>
<x/>
<y/>
<z/>
</something>
It must return 2, I thought about using, for this example:
int Get_total_x(){
int total=0;
for(xml_node<> *x=root_node->first_node("x"); x; x=x->next_sibling()){
total++;
};
return total;
};
Does RapidXML has a especific function for that?
Upvotes: 1
Views: 323
Reputation: 941
Your xml file section, I presume, is not valid: the <x>, <x>, <y>, <z>
elements aren't closed and are not empty.
You should write <x/>, <x/>, <y/>, <z/>
Upvotes: 0
Reputation: 3580
I am not familiar with rapidxml anyway I just gone through the code and I found
inline std::size_t count_children(xml_node<Ch> *node)
in rapidxml_utils.hpp
Upvotes: 0