Method: RubyXL::OOXMLTopLevelObject.parse_file

Defined in:
lib/rubyXL/objects/ooxml_object.rb

.parse_file(zip_file, file_path) ⇒ Object

Generates the top-level OOXML object by parsing its XML file from the contents of the .xslx container.

Parameters

  • zip_file - .xslx file as Zip::File object

  • file_path - path to the subject file inside the .xslx zip archive

[View source]

448
449
450
451
452
# File 'lib/rubyXL/objects/ooxml_object.rb', line 448

def self.parse_file(zip_file, file_path)
  entry = zip_file.find_entry(RubyXL::from_root(file_path))
  # Accomodate for Nokogiri Java implementation which is incapable of reading from a stream
  entry && (entry.get_input_stream { |f| parse(defined?(JRUBY_VERSION) ? f.read : f) })
end