1 (******************************************************************************)
2 (* SXSI : XPath evaluator *)
3 (* Kim Nguyen (Kim.Nguyen@nicta.com.au) *)
4 (* Copyright NICTA 2008 *)
5 (* Distributed under the terms of the LGPL (see LICENCE) *)
6 (******************************************************************************)
7 (* maybe utf8 string... *)
11 external to_int : t -> int = "%identity"
14 to_string : t -> string;
19 mutable tag_ : string -> t;
20 mutable to_string_ : t ->string;
21 mutable translate_ : t -> t
28 let dummy_fun =function _ -> failwith "Tag.ml Uninitialized tag structure"
32 to_string_ = dummy_fun;
33 translate_ = dummy_fun
38 ops.to_string_ <- p.to_string;
39 ops.translate_ <- p.translate
41 let tag s = ops.tag_ s
42 let to_string t = ops.to_string_ t
43 let translate s = ops.translate_ s
50 (* Defined in XMLTree.cpp *)
55 let document_node_close = 4
56 let attribute_close = 5
58 let attribute_data_close= 7
67 Format.eprintf "Tags are:\n";
68 let doc = get_pool() in
69 let ntags = num_tags doc in
70 for i = 0 to ntags - 1 do
71 Format.eprintf "%i, -><%s/>\n%!" i (to_string i)
76 let print ppf t = Format.fprintf ppf "%s" (to_string t)
77 (* Check internal invariants *)
79 if (t != tag (to_string t))
80 then failwith "module Tag: internal check failed"