]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/xml/xml.ml
Reshaped structure of ocaml/ libraries.
[helm.git] / helm / ocaml / xml / xml.ml
index 42ce7ba571564c7a80c12de4feeaa7a417a47e51..809e11d3ffdefd355eb2d23ab4112f93de791e81 100644 (file)
@@ -160,3 +160,16 @@ let add_xml_declaration stream =
       ] stream
   >]
 
+  (* TODO BRRRRR .... *)
+  (** strip first 4 line of a string, used to strip xml declaration and doctype
+  declaration from XML strings generated by Xml.pp_to_string *)
+let strip_xml_headings s =
+  let rec aux n pos =
+    if n = 0
+    then String.sub s pos (String.length s - pos)
+    else aux (n - 1) (String.index_from s pos '\n' + 1)
+  in
+  try
+    aux 4 0
+  with Not_found -> s
+