let fold _ _ _ = failwith "fold not implemented"
let map _ _ = failwith "map not implemented"
let length x = x
- let serialize _ _ _ = ()
+ let serialize f _ x =
+ let o = open_out f in
+ output_string o "<xml_result>\n";
+ output_string o (string_of_int x);
+ output_string o "\n</xml_result>\n";
+ close_out o
end
type clist =
Unix.close
in
ignore (Unix.write fd "<xml_result>\n" 0 13);
- iter (fun node -> Tree.print_xml v node fd) l;
- Tree.flush v fd;
+ if l.length > 0 then begin
+ iter (fun node -> Tree.print_xml v node fd) l;
+ Tree.flush v fd;
+ end;
ignore (Unix.write fd "</xml_result>\n" 0 14);
finish fd