Finish adapting to new libxml-tree API
[SXSI/xpathcomp.git] / src / tree.ml
index 66bf159..bc81cf4 100644 (file)
@@ -51,11 +51,11 @@ module TreeBuilder =
 struct
   type t
   external create : unit -> t = "caml_xml_tree_builder_create"
-  external open_document : t -> bool -> int -> bool -> int -> unit = "caml_xml_tree_builder_open_document"
+  external open_document : t -> int -> bool -> int -> unit = "caml_xml_tree_builder_open_document"
   external close_document : t -> tree = "caml_xml_tree_builder_close_document"
-  external open_tag : t -> string -> unit = "caml_xml_tree_builder_new_open_tag"
-  external close_tag : t -> string -> unit = "caml_xml_tree_builder_new_closing_tag"
-  external text : t -> string -> unit = "caml_xml_tree_builder_new_text"
+  external open_tag : t -> string -> unit = "caml_xml_tree_builder_open_tag"
+  external close_tag : t -> string -> unit = "caml_xml_tree_builder_close_tag"
+  external text : t -> string -> unit = "caml_xml_tree_builder_text"
 
   let is_whitespace s =
     let rec loop len i =
@@ -133,8 +133,7 @@ struct
     Expat.set_end_element_handler parser_ (end_element_handler parser_ build buf);
     Expat.set_character_data_handler parser_ (character_data_handler parser_ build buf);
     Logger.print Format.err_formatter "Started parsing@\n";
-    open_document build !Options.index_empty_texts !Options.sample_factor
-      !Options.disable_text_collection !Options.text_index_type;
+    open_document build !Options.sample_factor !Options.disable_text_collection !Options.text_index_type;
     open_tag build "";
     parser_, finalize
 
@@ -184,7 +183,7 @@ let bit_vector_unsafe_set v i b =
 
 let bit_vector_create n =
   let len = if n <= 0 then 0 else (n - 1) / 8 + 1 in
-  String.make len '\000' 
+  String.make len '\000'
 
 type t = {
   doc : tree;
@@ -264,14 +263,13 @@ let next_sibling t n = tree_next_sibling t.doc n
 external tree_next_element : tree -> [`Tree] Node.t -> [`Tree] Node.t = "caml_xml_tree_next_element"  "noalloc"
 let next_element t n = tree_next_element t.doc n
 
-external tree_next_node_before : tree -> [`Tree] Node.t -> [`Tree] Node.t -> [`Tree] Node.t = "caml_xml_tree_next_node_before"  "noalloc"
-let next_node_before t n ctx = tree_next_node_before t.doc n ctx
 
-external tree_tagged_following_sibling : tree -> [`Tree] Node.t -> Tag.t -> [`Tree] Node.t = "caml_xml_tree_tagged_following_sibling" "noalloc"
-let tagged_following_sibling t n tag = tree_tagged_following_sibling t.doc n tag
+external tree_tagged_sibling : tree -> [`Tree] Node.t -> Tag.t -> [`Tree] Node.t = "caml_xml_tree_tagged_sibling" "noalloc"
+let tagged_sibling t n tag = tree_tagged_sibling t.doc n tag
 
-external tree_select_following_sibling : tree -> [`Tree ] Node.t -> unordered_set -> [`Tree] Node.t = "caml_xml_tree_select_following_sibling" "noalloc"
-let select_following_sibling t n tag_set = tree_select_following_sibling t.doc n tag_set
+
+external tree_select_sibling : tree -> [`Tree ] Node.t -> unordered_set -> [`Tree] Node.t = "caml_xml_tree_select_sibling" "noalloc"
+let select_sibling t n tag_set = tree_select_sibling t.doc n tag_set
 
 external tree_prev_sibling : tree -> [`Tree] Node.t -> [`Tree] Node.t = "caml_xml_tree_prev_sibling" "noalloc"
 let prev_sibling t n = tree_prev_sibling t.doc n
@@ -296,11 +294,6 @@ let select_following_before t n tag_set ctx = tree_select_following_before t.doc
 external tree_parent : tree -> [`Tree] Node.t -> [`Tree] Node.t = "caml_xml_tree_parent" "noalloc"
 let parent t n = tree_parent t.doc n
 
-external tree_binary_parent : tree -> [`Tree] Node.t -> [`Tree] Node.t = "caml_xml_tree_binary_parent"
-  "noalloc"
-let binary_parent t n = tree_binary_parent t.doc n
-
-
 external tree_tag : tree -> [`Tree] Node.t -> Tag.t = "caml_xml_tree_tag" "noalloc"
 let tag t n = tree_tag t.doc n
 
@@ -326,7 +319,7 @@ open Format
 let dump_tag_table t =
   let tag = ref 0 in
   let printer ppf set =
-    Logger.print ppf "%s: %a" 
+    Logger.print ppf "%s: %a"
       (Tag.to_string !tag) TagSet.print (TagSet.inj_positive set);
     incr tag
   in