projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add serialization functions
[SXSI/xpathcomp.git]
/
tree.ml
diff --git
a/tree.ml
b/tree.ml
index
3bfbfce
..
9cab2c7
100644
(file)
--- a/
tree.ml
+++ b/
tree.ml
@@
-13,6
+13,8
@@
sig
type t
val parse_xml_uri : string -> t
val parse_xml_string : string -> t
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
val tag_pool : t -> Tag.pool
val string : t -> string
val descr : t -> descr
@@
-45,11
+47,12
@@
struct
external int_of_node : 'a node -> int = "%identity"
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 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
module Text =
struct
@@
-191,6
+194,11
@@
struct
!Options.disable_text_collection),__LOCATION__))
!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"
let tag_pool t = pool t.doc
external pool : doc -> Tag.pool = "%identity"
let tag_pool t = pool t.doc