xml_tree::node_t y = bp_find_close(this->par, x);
if (y - x < 10) {
uint32_t count = 0;
- for(xml_tree::node_t i = x; i < y; i++)
+ for (xml_tree::node_t i = x; i <= y; ++i)
count += (tag(i) == label);
return count;
} else {
- return tags[label]->rank(y) - tags[label]->rank(x);
- };
+ return tags[label]->rank(y) - tags[label]->rank(x);
+ }
}
-inline uint32_t xml_tree::subtree_elements(xml_tree::node_t x,
- xml_tree::tag_t *atts) const
+inline uint32_t xml_tree::subtree_elements(xml_tree::node_t x) const
{
int32_t size = bp_subtree_size(par, x) - 1;
if (size <= 0) return 0;
size -= subtree_tags(x, xml_tree::PCDATA_OPEN_TAG_ID);
+ size -= subtree_tags(x, xml_tree::ATTRIBUTE_OPEN_TAG_ID);
+ size -= subtree_tags(x, xml_tree::ATTRIBUTE_DATA_OPEN_TAG_ID);
if (size < 3) return (uint32_t) size;
- for(; *atts != xml_tree::NIL_TAG_ID; atts++)
- size -= subtree_tags(x, *atts);
+ std::unordered_set<xml_tree::tag_t>::iterator it;
+ for(it = this->attribute_ids->begin();
+ it != this->attribute_ids->end();
+ ++it)
+ size -= subtree_tags(x, *it);
return (uint32_t) size;
}