# Pastebin ZWNBDGdC let convert_test source = printf "### SOURCE ###\n\n%s\n" source; let input = Xmlm.make_input ~entity:(fun s -> Some s) ~ns:(fun s -> Some s) (`String (0,source)) in let (_,tree) = Xmlm.input_doc_tree input ~el:(fun tag children -> let tag = tag_of_xmlm_tag tag in El { tag; children }) ~data:(fun x -> Data x) in printf "\n### PARSED ###\n\n"; print_s [%sexp (tree : xml)]; printf "\n### PRINTED ###\n\n"; Xmlm.output_doc_tree (function | Data d -> `Data d | El {tag;children} -> `El (xmlm_tag_of_tag tag, children)) (Xmlm.make_output ~indent:(Some 2) ~ns_prefix:(fun s -> Some s) (`Channel stdout) ) (None,tree); Out_channel.newline stdout ;;