Remove the timestamp header in source files. This information is
[tatoo.git] / src / qName.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16 include Hcons.Make (struct
17   include String
18   let hash s = Hashtbl.hash s
19   let equal s1 s2 = s1 = s2
20 end)
21
22 let print pp s = Format.fprintf pp "%s" s.node
23
24 let of_string = make
25 let to_string = node
26
27 let document = of_string "#document"
28 let text = of_string "#text"
29 let comment = of_string "#comment"
30 let nil = of_string "#"
31
32 let attribute t = of_string ( "@" ^ (to_string t))
33 let processing_instruction t = of_string ( "?" ^ (to_string t))
34
35 let remove_prefix t =
36   let s = to_string t in
37   let lens = String.length s in
38   if lens == 0 then t
39   else
40     if s.[0] == '@' || s.[0] == '?' then
41       of_string (String.sub s 1 (lens-1))
42     else
43       t