+inline xml_tree::node_t
+xml_tree::select_descendant(xml_tree::node_t x, xml_tree::tag_t *tags) const
+{
+ if (is_leaf(x)) return xml_tree::NIL;
+ auto min = xml_tree::NIL;
+ auto aux = xml_tree::NIL;
+ for(; *tags != xml_tree::NIL_TAG_ID; ++tags){
+ aux = tagged_next(x, *tags);
+ if ((unsigned int) aux < (unsigned int) min) min = aux;
+ };
+ return (min == xml_tree::NIL || is_ancestor(x, min)) ? min : xml_tree::NIL;
+}
+
+
+inline xml_tree::node_t
+xml_tree::select_following_before(xml_tree::node_t x, xml_tree::tag_t *tags,
+ xml_tree::node_t limit) const
+{
+ auto min = xml_tree::NIL;
+ auto aux = xml_tree::NIL;
+ auto close = bp_find_close(this->par, x);
+
+ for(; *tags != xml_tree::NIL_TAG_ID; ++tags){
+ aux = tagged_next(close, *tags);
+ if ((unsigned int) aux < (unsigned int) min) min = aux;
+ }
+
+ return (min == xml_tree::NIL || min < limit) ? min : xml_tree::NIL;
+}
+
+