Merge branch 'master' of ssh://git.nguyen.vg/tatoo
[tatoo.git] / src / qName.ml
index 5d41943..4a3aac4 100644 (file)
 (*                                                                     *)
 (***********************************************************************)
 
+(*
+  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
@@ -26,8 +30,18 @@ let to_string = node
 
 let document = of_string "#document"
 let text = of_string "#text"
-let cdata_section = of_string "#cdata-section"
 let comment = of_string "#comment"
-let document_fragment = of_string "#document-fragment"
-let attribute_map = of_string "#attribute-map"
 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