lib/xmlsimple.rb in xml-simple-1.0.14 vs lib/xmlsimple.rb in xml-simple-1.0.15

- old
+ new

@@ -1,19 +1,19 @@ # = XmlSimple # # Author:: Maik Schmidt <contact@maik-schmidt.de> -# Copyright:: Copyright (c) 2003-2009 Maik Schmidt +# Copyright:: Copyright (c) 2003-2011 Maik Schmidt # License:: Distributes under the same terms as Ruby. # require 'rexml/document' require 'stringio' # Easy API to maintain XML (especially configuration files). class XmlSimple include REXML - @@VERSION = '1.0.13' + @@VERSION = '1.0.15' # A simple cache for XML documents that were already transformed # by xml_in. class Cache # Creates and initializes a new Cache object. @@ -798,12 +798,15 @@ end value = {} end # Check for the '@' attribute prefix to allow separation of attributes and elements - if @options['noattr'] || - (@options['attrprefix'] && !(key =~ /^@(.*)/)) || - !scalar(value) + + if (@options['noattr'] || + (@options['attrprefix'] && !(key =~ /^@(.*)/)) || + !scalar(value) + ) && + key != @options['contentkey'] nested << value_to_xml(value, key, indent + @options['indent']) else value = value.to_s value = escape_value(value) unless @options['noescape'] if key == @options['contentkey']