+
+(*Lucca Hirschi: *)
+let rec print_xml_preorder out tree_ node =
+ if node != nil then
+ let () =
+ if node.tag == QName.text then
+ begin
+ output_escape_string out node.data;
+ output_string out ("'"^(string_of_int(preorder tree_ node)));
+ end
+ else
+ let tag = QName.to_string node.tag in
+ output_char out '<';
+ output_string out tag;
+ output_string out (" '"^(string_of_int(preorder tree_ node)));
+ let fchild =
+ if node.first_child.tag == QName.attribute_map then
+ let () =
+ let ffn = node.first_child.first_child in
+ print_attributes out tree_ ffn;
+ in
+ node.first_child.next_sibling
+ else
+ node.first_child
+ in
+ if fchild == nil then output_string out "/>"
+ else begin
+ output_char out '>';
+ print_xml_preorder out tree_ fchild;
+ output_string out "</";
+ output_string out tag;
+ output_char out '>'
+ end
+ in
+ print_xml_preorder out tree_ node.next_sibling
+
+let debug_node fmt t n =
+ Parser.debug_node fmt n