]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/xml2Gdomexmath.ml
Xml.token is now namespace-aware. As a consequence, xml2Gdomexmath is
[helm.git] / helm / ocaml / cic_transformations / xml2Gdomexmath.ml
diff --git a/helm/ocaml/cic_transformations/xml2Gdomexmath.ml b/helm/ocaml/cic_transformations/xml2Gdomexmath.ml
deleted file mode 100644 (file)
index 0b2db0d..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-(* Copyright (C) 2000-2002, HELM Team.
- * 
- * This file is part of HELM, an Hypertextual, Electronic
- * Library of Mathematics, developed at the Computer Science
- * Department, University of Bologna, Italy.
- * 
- * HELM is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * HELM is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HELM; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA  02111-1307, USA.
- * 
- * For details, see the HELM World-Wide-Web page,
- * http://cs.unibo.it/helm/.
- *)
-
-(* cut and paste from xml2Gdome.ml: there was the namespace problem.
-   This is a fst patch: we generate a fixed namespace for math *)
-let document_of_xml (domImplementation : Gdome.domImplementation) strm =
- let module G = Gdome in
- let module X = Xml in
- let namespace = "http://www.w3.org/1998/Math/MathML" in
-  let root_name,root_attributes,root_content =
-   (* 
-   ignore (Stream.next strm) ; (* to skip the <?xml ...?> declaration *)
-   ignore (Stream.next strm) ; (* to skip the DOCTYPE declaration *)
-   *)
-   match Stream.next strm with
-      X.Empty(n,l) -> n,l,[<>]
-    | X.NEmpty(n,l,c) -> n,l,c
-    | _ -> assert false
-  in
-   let document =
-    domImplementation#createDocument ~namespaceURI:(Some (Gdome.domString namespace))
-     ~qualifiedName:(Gdome.domString ("m:" ^ root_name)) ~doctype:None
-   in
-   document#get_documentElement#setAttribute (Gdome.domString "xmlns:m") (Gdome.domString namespace);
-   let rec aux (node : Gdome.node) =
-    parser
-      [< 'X.Str a ; s >] ->
-        let textnode = document#createTextNode ~data:(Gdome.domString a) in
-         ignore (node#appendChild ~newChild:(textnode :> Gdome.node)) ;
-         aux node s
-    | [< 'X.Empty(n,l) ; s >] ->
-        let element = document#createElementNS
-         ~namespaceURI:(Some (Gdome.domString namespace))
-         ~qualifiedName:(Gdome.domString ("m:" ^ n)) in
-         List.iter 
-           (function (n,v) -> 
-            let i = 
-              (try String.index n ':' 
-               with Not_found -> 0) in
-            if i = 0 then
-              element#setAttribute
-              ~name:(Gdome.domString n) ~value:(Gdome.domString v) 
-            else
-              let ns_label = String.sub n 0 i in
-              let ns = 
-                if ns_label = "helm" then "http://www.cs.unibo.it/helm"
-                else if ns_label = "xlink" then "http://www.w3.org/1999/xlink"
-                else assert false in
-              element#setAttributeNS 
-               ~namespaceURI:(Some (Gdome.domString ns))
-               ~qualifiedName:(Gdome.domString n) 
-               ~value:(Gdome.domString v)) l ;
-         ignore
-          (node#appendChild ~newChild:(element : Gdome.element :> Gdome.node)) ;
-         aux node s
-    | [< 'X.NEmpty(n,l,c) ; s >] ->
-        let element = document#createElementNS 
-         ~namespaceURI:(Some (Gdome.domString namespace))
-         ~qualifiedName:(Gdome.domString ("m:" ^ n)) in
-         List.iter
-          (function (n,v) -> 
-            let i = 
-              (try String.index n ':' 
-               with Not_found -> 0) in
-            if i = 0 then
-              element#setAttribute
-              ~name:(Gdome.domString n) ~value:(Gdome.domString v) 
-            else
-              let ns_label = String.sub n 0 i in
-              let ns = 
-                if ns_label = "helm" then "http://www.cs.unibo.it/helm"
-                else if ns_label = "xlink" then "http://www.w3.org/1999/xlink"
-                else assert false in
-              element#setAttributeNS 
-               ~namespaceURI:(Some (Gdome.domString ns))
-               ~qualifiedName:(Gdome.domString n) 
-               ~value:(Gdome.domString v)) l ;
-         ignore (node#appendChild ~newChild:(element :> Gdome.node)) ;
-         aux (element :> Gdome.node) c ;
-         aux node s
-    | [< >] -> ()
-   in
-    let root = document#get_documentElement in
-     List.iter (function (n,v) -> root#setAttribute
-      ~name:(Gdome.domString n) ~value:(Gdome.domString v)) root_attributes ;
-     aux (root : Gdome.element :> Gdome.node) root_content ;
-     document
-;;
-