lib/plist4r/backend/libxml4r.rb in plist4r-0.2.0 vs lib/plist4r/backend/libxml4r.rb in plist4r-0.2.1
- old
+ new
@@ -52,11 +52,22 @@
require 'rubygems'
require 'libxml4r'
::LibXML::XML.default_keep_blanks = false
doc = string.to_xmldoc
doc.strip!
+
root = doc.node["/plist/dict"]
- ordered_hash = tree_hash root
+ ordered_hash = nil
+ if root
+ ordered_hash = tree_hash root
+ else
+ root = doc.node["/plist/array"]
+ if root
+ ordered_hash = ::ActiveSupport::OrderedHash.new
+ ordered_hash["Array"] = tree_array root
+ end
+ end
+ ordered_hash
end
def from_string plist, string
plist_format = Plist4r.string_detect_format string
raise "#{self} - cant convert string of format #{plist_format}" unless plist_format == :xml