* http://cs.unibo.it/helm/.
*)
+let myprerr_endline = prerr_endline;;
+let prerr_endline _ = ();;
+
let update_dom ~(from : Gdome.document) (d : Gdome.document) =
let rec aux (p: Gdome.node) (f: Gdome.node) (t: Gdome.node) =
(* Perche' non andava?
let name = attr#get_nodeName in
match tattrs#getNamedItem ~name with
None ->
-prerr_endline ("XML_DIFF: rimuovo l'attributo " ^ name#to_string);
+myprerr_endline ("XML_DIFF: rimuovo l'attributo " ^ name#to_string);
ignore (f#removeChild attr)
| Some attr' ->
processed :=
->
prerr_endline ("XML_DIFF: DOM 1; preservo l'attributo " ^ name#to_string);
()
- | Some _, Some _ ->
-prerr_endline ("XML_DIFF: DOM 1; rimpiazzo l'attributo " ^ name#to_string);
+ | Some v1, Some v2 ->
+myprerr_endline ("XML_DIFF: DOM 1; rimpiazzo l'attributo " ^ name#to_string ^ ": old value=" ^ v1#to_string ^ ", new value=" ^ v2#to_string);
let attr'' = from#importNode attr' true in
ignore (fattrs#setNamedItem attr'')
| _,_ -> assert false
tattrs#getNamedItemNS ~namespaceURI ~localName
with
None ->
-prerr_endline ("XML_DIFF: rimuovo l'attributo " ^ localName#to_string);
+myprerr_endline ("XML_DIFF: rimuovo l'attributo " ^ localName#to_string);
ignore (f#removeChild attr)
| Some attr' ->
processed :=
prerr_endline ("XML_DIFF: DOM 2; preservo l'attributo " ^ namespaceURI#to_string ^ ":" ^ localName#to_string);
()
| Some _, Some _ ->
-prerr_endline ("XML_DIFF: DOM 2; rimpiazzo l'attributo " ^ namespaceURI#to_string ^ ":" ^ localName#to_string);
+myprerr_endline ("XML_DIFF: DOM 2; rimpiazzo l'attributo " ^ namespaceURI#to_string ^ ":" ^ localName#to_string);
let attr'' = from#importNode attr' true in
ignore (fattrs#setNamedItem attr'')
| _,_ -> assert false
) !processed)
then
let attr' = from#importNode attr false in
-prerr_endline !debugs ;
+myprerr_endline !debugs ;
ignore (fattrs#setNamedItem attr')
done
| _,_ -> assert false
aux f he1 he2 ;
dumb_diff (tl1,tl2)
| [],tl2 ->
-prerr_endline "XML_DIFF: appendo i nodi residui" ;
+myprerr_endline "XML_DIFF: appendo i nodi residui" ;
List.iter
(function n ->
let n' = from#importNode n true in
ignore (f#appendChild n')
) tl2
| tl1,[] ->
-prerr_endline "XML_DIFF: cancello i nodi residui" ;
+myprerr_endline "XML_DIFF: cancello i nodi residui" ;
List.iter (function n -> ignore (f#removeChild n)) tl1
in
let node_list_of_nodeList nl =
(t1 = GdomeNodeTypeT.ELEMENT_NODE || t1 = GdomeNodeTypeT.TEXT_NODE) &&
(t2 = GdomeNodeTypeT.ELEMENT_NODE || t2 = GdomeNodeTypeT.TEXT_NODE) ->
let t' = from#importNode t true in
-prerr_endline "XML_DIFF: importo il nodo" ;
+myprerr_endline "XML_DIFF: importo il nodo" ;
(*
prerr_endline ("Rimpiazzo" ^ (match f#get_namespaceURI with Some s -> s#to_string) ^ ":" ^ (match f#get_localName with Some s -> s#to_string) ^ " con " ^ (match t#get_namespaceURI with Some s -> s#to_string) ^ ":" ^ (match t#get_localName with Some s -> s#to_string) ^ " in " ^ (match p#get_localName with Some s -> s#to_string | None -> "_")) ;
*)