X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tag.ml;h=c692e980970d69b43c598c1f2f3754e44a8aa552;hb=0c2338bfcdae0df1c68112a10247dc4e68a483ff;hp=82c42b5757db837779aecd0cbacb5380d07de142;hpb=d64e3a3a9ef6329caafdba848ef78427fce0d689;p=SXSI%2Fxpathcomp.git diff --git a/tag.ml b/tag.ml index 82c42b5..c692e98 100644 --- a/tag.ml +++ b/tag.ml @@ -13,12 +13,20 @@ type pool external null_pool : unit -> pool = "caml_xml_tree_nullt" external null_tag : unit -> t = "caml_xml_tree_nullt" external register_tag : pool -> string -> t = "caml_xml_tree_register_tag" -external tag_name : pool -> t -> string = "caml_xml_tree_tag_name" +external tag_name : pool -> t -> string = "caml_xml_tree_get_tag_name" let nullt = null_tag () +let dummy = nullt (* Defined in XMLTree.cpp *) -let pcdata = 1 -let attribute = 0 +let document_node = 0 +let attribute = 1 +let pcdata = 2 +let attribute_data= 3 +let document_node_close = 4 +let attribute_close = 5 +let pcdata_close = 6 +let attribute_data_close= 7 + let pool = Weak.create 1 @@ -31,6 +39,8 @@ let get_pool () = match Weak.get pool 0 with let tag s = match s with | "<$>" -> pcdata | "<@>" -> attribute + | "" -> document_node + | "<@$>" -> attribute_data | _ -> register_tag (get_pool()) s let compare = (-) @@ -40,8 +50,10 @@ let hash x = x let to_string t = - if t = pcdata then "<$>" - else if t = attribute then "<@>" + if t == pcdata then "<$>" + else if t == attribute_data then "<@$>" + else if t == attribute then "<@>" + else if t == nullt then "" else tag_name (get_pool()) t