# File TagTreeScanner.rb, line 551
                def to_xml( empty_tags_collapsed=true )
                        out = "<#{@tag_name}"
                        @attributes.each{ |k,v| out << " #{k}=\"#{v.to_s.gsub( '""', '&quot;' )}\"" }
                        if empty_tags_collapsed && @child_tags.empty?
                                out << ' />'
                        else
                                out << '>'
                                unless @child_tags.empty?
                                        out << "\n" unless self.allows_text?
                                        @child_tags.each{ |tag|
                                                out << tag.to_xml( empty_tags_collapsed )
                                        }
                                end 
                                out << "</#{@tag_name}>"
                        end
                        out << "\n" if @parent_tag && !@parent_tag.allows_text?
                        out
                end