Record which tag ids map to attribute nodes. Use that in subtree_element
[SXSI/XMLTree.git] / xml-tree.hpp
index bfeff5f..436e2f9 100644 (file)
@@ -3,6 +3,7 @@
 
 
 #include <cstdint>
+#include <unordered_set>
 #include <unordered_map>
 #include <libbp/bp.h>
 #include <libbp/bp-darray.h>
@@ -50,7 +51,7 @@ public:
   inline uint32_t num_tags() const;
   inline uint32_t subtree_size(node_t) const;
   inline uint32_t subtree_tags(node_t, tag_t) const;
-  inline uint32_t subtree_elements(node_t, tag_t*) const;
+  inline uint32_t subtree_elements(node_t) const;
   uint32_t num_children(node_t) const;
   uint32_t child_pos(node_t) const;
 
@@ -138,6 +139,8 @@ private:
   //Mapping from tag_t identifiers to/from tagnames
   std::vector<std::string> *tag_names;
   std::unordered_map<std::string, tag_t> *tag_ids;
+  //Set of tag ids that map to attribute nodes
+  std::unordered_set<tag_t> *attribute_ids;
   //Text index
   SXSI::TextCollection *text_collection;
   static_bitsequence *text_positions;