Flatten the sources, only leave the XPath module packed.
[tatoo.git] / src / qName.ml
diff --git a/src/qName.ml b/src/qName.ml
new file mode 100644 (file)
index 0000000..4a3aac4
--- /dev/null
@@ -0,0 +1,47 @@
+(***********************************************************************)
+(*                                                                     *)
+(*                               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.                                                        *)
+(*                                                                     *)
+(***********************************************************************)
+
+(*
+  Time-stamp: <Last modified on 2013-03-10 23:05:56 CET by Kim Nguyen>
+*)
+
+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