lib/rbNokogiriParser.rb in CFPropertyList-2.1 vs lib/rbNokogiriParser.rb in CFPropertyList-2.1.1
- old
+ new
@@ -8,9 +8,11 @@
# read a XML file
# opts::
# * :file - The filename of the file to load
# * :data - The data to parse
def load(opts)
+
+ doc = nil
if(opts.has_key?(:file)) then
File.open(opts[:file], "rb") { |fd| doc = Nokogiri::XML::Document.parse(fd, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT) }
else
doc = Nokogiri::XML::Document.parse(opts[:data], nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT)
end