+
+let output_escape_string out s =
+ for i = 0 to String.length s - 1 do
+ match s.[i] with
+ | '<' -> output_string out "<"
+ | '>' -> output_string out ">"
+ | '&' -> output_string out "&"
+ | '"' -> output_string out """
+ | '\'' -> output_string out "'"
+ | c -> output_char out c
+ done
+
+let rec print_attributes out tree_ node =
+ if node != nil then begin
+ output_string out (QName.to_string node.tag);
+ output_string out "=\"";
+ output_escape_string out node.first_child.data;
+ output_char out '"';
+ print_attributes out tree_ node.next_sibling
+ end
+