class CFPropertyList::List

def load_str(str=nil,format=nil)

format = nil:: The format of the plist
str = nil:: The string containing the plist
load a plist from a string
def load_str(str=nil,format=nil)
  str = @data if str.nil?
  format = @format if format.nil?
  @value = {}
  case format
  when List::FORMAT_BINARY, List::FORMAT_XML, List::FORMAT_PLAIN then
    prsr = @@parsers[format-1].new
    @value = prsr.load({:data => str})
  when List::FORMAT_AUTO then # what we now do is ugly, but neccessary to recognize the file format
    filetype = str[0..5]
    version = str[6..7]
    prsr = nil
    if filetype == "bplist" then
      raise CFFormatError.new("Wrong file version #{version}") unless version == "00"
      prsr = Binary.new
      @format = List::FORMAT_BINARY
    else
      if str =~ /^<(\?xml|!DOCTYPE|plist)/
        prsr = CFPropertyList.xml_parser_interface.new
        @format = List::FORMAT_XML
      else
        prsr = PlainParser.new
        @format = List::FORMAT_PLAIN
      end
    end
    @value = prsr.load({:data => str})
  end
end