btrace_print_xml() implementation and tests