Making the output predictable simplifies unit tests, and doesn't cost
much given that most xml element have few attributes
1 files changed, 1 insertions(+), 1 deletions(-)

M src/rexml/formatters/default.rb
M src/rexml/formatters/default.rb +1 -1
@@ 63,7 63,7 @@ module REXML
       def write_element( node, output )
         output << "<#{node.expanded_name}"
 
-        node.attributes.each_attribute do |attr|
+        node.attributes.to_a.sort_by {|attr| attr.name}.each do |attr|
           output << " "
           attr.write( output )
         end unless node.attributes.empty?