(******************************************************************************) (* SXSI : XPath evaluator *) (* Kim Nguyen (Kim.Nguyen@nicta.com.au) *) (* Copyright NICTA 2008 *) (* Distributed under the terms of the LGPL (see LICENCE) *) (******************************************************************************) (* maybe utf8 string... *) type t = int 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" let nullt = null_tag () let pcdata = max_int let attribute = max_int - 1 let pool = ref (null_pool ()) let init p = pool := p let tag s = match s with | "<$>" -> pcdata | "<@>" -> attribute | _ -> register_tag !pool s let compare = (-) let equal = (==) let to_string t = if t = pcdata then "<$>" else if t = attribute then "<@>" else tag_name !pool t let print ppf t = Format.fprintf ppf "%s" (to_string t)