lib/xmlsimple.rb in xml-simple-1.0.9 vs lib/xmlsimple.rb in xml-simple-1.0.10

- old
+ new

@@ -926,19 +926,18 @@ # node:: # Document node to be converted. # default:: # Value to be returned, if node could not be converted. def node_to_text(node, default = nil) - result = if node.instance_of?(Element) - node.texts.join('') - elsif node.instance_of?(Attribute) + if node.instance_of?(REXML::Element) + node.texts.map { |t| t.value }.join('') + elsif node.instance_of?(REXML::Attribute) node.value.nil? ? default : node.value.strip - elsif node.instance_of?(Text) - node.to_s.strip + elsif node.instance_of?(REXML::Text) + node.value.strip else default end - Text::unnormalize(result) end # Parses an XML string and returns the according document. # # xml_string::