def to_xml(options={})
root = options[:root] || Inflector.underscore(self.class.name)
result = "<#{root}>\n"
result << " <dn>#{dn}</dn>\n"
normalize_data(@data).sort_by {|key, values| key}.each do |key, values|
targets = []
values.each do |value|
if value.is_a?(Hash)
value.each do |option, real_value|
targets << [real_value, " #{option}=\"true\""]
end
else
targets << [value]
end
end
targets.sort_by {|value, attr| value}.each do |value, attr|
result << " <#{key}#{attr}>#{value}</#{key}>\n"
end
end
result << "</#{root}>\n"
result
end