]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/xml/xmlPushParser.ml
ocaml 3.09 transition
[helm.git] / helm / ocaml / xml / xmlPushParser.ml
index ae93f4e6a4ff6d352d301ba2582eccc461a41a4e..6cab0ead3c6980aee30f001808c068ff5b440e5b 100644 (file)
@@ -53,6 +53,8 @@ type position = int * int
 
 type xml_parser = Expat.expat_parser
 
+exception Parse_error of string
+
 let create_parser callbacks =
   let expat_parser = Expat.parser_create ~encoding:None in
   (match callbacks.start_element with
@@ -106,3 +108,9 @@ let parse expat_parser =
   in
   aux
 
+let parse expat_parser xml_source =
+  try
+    parse expat_parser xml_source
+  with Expat.Expat_error xml_error ->
+    raise (Parse_error (Expat.xml_error_to_string xml_error))
+