X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Futils%2FqName.ml;h=4a3aac4a312c99768673d417a1350f81425d563e;hp=d3f0a43f9f61df0882ce7d3fba85b9f894ee1150;hb=53a0fd29a20e7f4550e0eb5fa5b0d5af6191c36d;hpb=7c1d3641c4c5d7bde075df20863ab4242df3b763 diff --git a/src/utils/qName.ml b/src/utils/qName.ml index d3f0a43..4a3aac4 100644 --- a/src/utils/qName.ml +++ b/src/utils/qName.ml @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) include Hcons.Make (struct @@ -30,15 +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_prefix = of_string "@" -let has_attribute_prefix s = - let s = node s in - String.length s > 0 && s.[0] = '@' -let add_attribute_prefix s = - of_string ("@" ^ (node s)) +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