Add an abstract generic interface for trees (of which Naive is an
[tatoo.git] / src / tree / naive.ml
index 37683f3..db1b202 100644 (file)
@@ -14,7 +14,7 @@
 (***********************************************************************)
 
 (*
-  Time-stamp: <Last modified on 2013-03-04 23:40:26 CET by Kim Nguyen>
+  Time-stamp: <Last modified on 2013-03-05 16:20:32 CET by Kim Nguyen>
 *)
 open Utils
 
@@ -72,7 +72,7 @@ struct
           "NODE " ^  string_of_int n.preorder)
 
   let debug_node fmt node =
-    Format.fprintf fmt "{ tag=%s; preorder=%i; data=%s; first_child=%a; next_sibling=%a; parent=%a }"
+    Format.fprintf fmt "{ tag=%s; preorder=%i; data=%S; first_child=%a; next_sibling=%a; parent=%a }"
       (QName.to_string node.tag)
       node.preorder
       node.data
@@ -264,7 +264,7 @@ let rec print_xml out tree_ node =
   in
   print_xml out tree_ node.next_sibling
 
-
+let print_xml out tree_ node = print_xml out tree_ { node with next_sibling = nil }
 let root t = t.root
 let first_child _ n = n.first_child
 let next_sibling _ n = n.next_sibling
@@ -272,3 +272,5 @@ let parent _ n = n.parent
 let tag _ n = n.tag
 let data _ n = n.data
 let preorder _ n = n.preorder
+
+let print_node fmt n = Parser.debug_node fmt n