lib/xmlsimple.rb in xml-simple-1.0.7 vs lib/xmlsimple.rb in xml-simple-1.0.8

- old
+ new

@@ -1,18 +1,19 @@ # = XmlSimple # # Author:: Maik Schmidt <contact@maik-schmidt.de> -# Copyright:: Copyright (c) 2003 Maik Schmidt +# Copyright:: Copyright (c) 2003-2006 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.2' + @@VERSION = '1.0.8' # A simple cache for XML documents that were already transformed # by xml_in. class Cache # Creates and initializes a new Cache object. @@ -182,10 +183,10 @@ } end @doc = load_xml_file(filename) end - elsif string.kind_of?(IO) + elsif string.kind_of?(IO) || string.kind_of?(StringIO) @doc = parse(string.readlines.to_s) else raise ArgumentError, "Could not parse object of type: <#{string.type}>." end