]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/xml/xmlPushParser.ml
- added some cicbrowser screenshot (to be better placed in the text body)
[helm.git] / helm / ocaml / xml / xmlPushParser.ml
index ae93f4e6a4ff6d352d301ba2582eccc461a41a4e..4f57e124227b398d68fc88e2078be5a9796740a1 100644 (file)
@@ -23,6 +23,8 @@
  * http://helm.cs.unibo.it/
  *)
 
+(* $Id$ *)
+
 let gzip_bufsize = 10240
 
 type callbacks = {
@@ -53,6 +55,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 +110,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))
+