(***********************************************************************) (* *) (* TAToo *) (* *) (* Kim Nguyen, LRI UMR8623 *) (* Université Paris-Sud & CNRS *) (* *) (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) (* Recherche Scientifique. All rights reserved. This file is *) (* distributed under the terms of the GNU Lesser General Public *) (* License, with the special exception on linking described in file *) (* ../LICENSE. *) (* *) (***********************************************************************) include Hcons.Make (struct include String let hash s = Hashtbl.hash s let equal s1 s2 = s1 = s2 end) let print pp s = Format.fprintf pp "%s" s.node let of_string = make let to_string = node let document = of_string "#document" let text = of_string "#text" let comment = of_string "#comment" let nil = of_string "#" let attribute t = of_string ( "@" ^ (to_string t)) let processing_instruction t = of_string ( "?" ^ (to_string t)) let remove_prefix t = let s = to_string t in let lens = String.length s in if lens == 0 then t else if s.[0] == '@' || s.[0] == '?' then of_string (String.sub s 1 (lens-1)) else t