weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.28k stars 255 forks source link

RuntimeError: Unknown child node [x:fileVersion] for element [workbook] #240

Closed ngiger closed 4 years ago

ngiger commented 8 years ago

Betriebe_20160823.xlsx

With IRB (Ruby 2.3.1) I cannot parse this file.
irb(main):001:0> require 'rubyXL' => true irb(main):002:0> workbook= RubyXL::Parser.parse 'Betriebe_20160823.xlsx' RuntimeError: Unknown child node [x:fileVersion] for element [workbook] from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/ooxml_object.rb:155:in block in parse' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/xml/node_set.rb:187:inblock in each' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/xml/node_set.rb:186:in upto' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/xml/node_set.rb:186:ineach' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/ooxml_object.rb:144:in parse' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/ooxml_object.rb:440:inblock in parse_file' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyzip-1.2.0/lib/zip/entry.rb:495:in get_input_stream' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/ooxml_object.rb:440:inparse_file' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/relationships.rb:91:in block in load_related_files' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/relationships.rb:76:ineach' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/relationships.rb:76:in load_related_files' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/relationships.rb:179:inload_relationships' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/objects/root.rb:66:in parse_zip_file' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/parser.rb:8:inblock in parse' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyzip-1.2.0/lib/zip/file.rb:102:in open' from /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rubyXL-3.3.21/lib/rubyXL/parser.rb:7:inparse' from (irb):2 from /home/niklaus/.rbenv/versions/2.3.1/bin/irb:11:in `

'

arohr commented 4 years ago

Hi @ngiger

I have the same problem here. Have you found a solution to this problem?

btw: wir kennen uns von früher (mindclue)...

Andy

weshatheleopard commented 4 years ago

@arohr do you have a sample file that exhibits this behavior?

arohr commented 4 years ago

@weshatheleopard Yes: Aggregates.xlsx

This file was generated by some other software. If I open it with LibreOffice Calc and save it again, rubyXL can parse it without any problems.

weshatheleopard commented 4 years ago

@arohr: your 3rd party software was generating the file that isn't exactly up to spec (but not terribly out of spec either). I fixed the issue, your file opens without a hitch for me now. Update the gem and try again.