X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tree.ml;h=9cab2c791f45cf72d13fe8881c6043296495f73f;hb=6b03c8ef3dac4b1de06ca577e8e0ee07c6c3eae7;hp=ecd8e3b9ac317fe628e5e46f63eed1e64c9ac559;hpb=eebef30070a951d852ce5811b289d8131a5300eb;p=SXSI%2Fxpathcomp.git diff --git a/tree.ml b/tree.ml index ecd8e3b..9cab2c7 100644 --- a/tree.ml +++ b/tree.ml @@ -4,6 +4,7 @@ (* Copyright NICTA 2008 *) (* Distributed under the terms of the LGPL (see LICENCE) *) (******************************************************************************) +INCLUDE "debug.ml" module type BINARY = sig type node_content @@ -12,6 +13,8 @@ sig type t val parse_xml_uri : string -> t val parse_xml_string : string -> t + val save : t -> string -> unit + val load : ?sample:int -> string -> t val tag_pool : t -> Tag.pool val string : t -> string val descr : t -> descr @@ -44,11 +47,12 @@ struct external int_of_node : 'a node -> int = "%identity" - external parse_xml_uri : string -> int -> bool -> bool -> t = "caml_call_shredder_uri" - - + external parse_xml_uri : string -> int -> bool -> bool -> t = "caml_call_shredder_uri" external parse_xml_string : string -> int -> bool -> bool -> t = "caml_call_shredder_string" + external save_tree : t -> string -> unit = "caml_xml_tree_save" + external load_tree : string -> int -> t = "caml_xml_tree_load" + module Text = struct @@ -178,12 +182,21 @@ struct let parse_xml_uri str = node_of_t - (parse_xml_uri str - !Options.sample_factor !Options.index_empty_texts !Options.disable_text_collection) + (MM((parse_xml_uri str + !Options.sample_factor + !Options.index_empty_texts + !Options.disable_text_collection),__LOCATION__)) let parse_xml_string str = node_of_t - (parse_xml_string str - !Options.sample_factor !Options.index_empty_texts !Options.disable_text_collection) + (MM((parse_xml_string str + !Options.sample_factor + !Options.index_empty_texts + !Options.disable_text_collection),__LOCATION__)) + + + let save t str = save_tree t.doc str + + let load ?(sample=64) str = node_of_t (load_tree str sample) external pool : doc -> Tag.pool = "%identity" @@ -384,8 +397,8 @@ end - - +IFDEF DEBUG +THEN module DEBUGTREE = struct @@ -572,3 +585,6 @@ module DEBUGTREE end module Binary = DEBUGTREE +ELSE +module Binary = XML.Binary +END (* IFDEF DEBUG *)