Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Nokogiri::XML::SyntaxError (1:1: FATAL: Document is empty)" on parsing the buffer more than once #439

Open
Nakilon opened this issue Mar 17, 2023 · 1 comment

Comments

@Nakilon
Copy link

Nakilon commented Mar 17, 2023

$ bundle exec irb -rrubyXL
irb> t = File.binread "temp.xlsx"
=> "PK\x03\x04\x14...
irb> RubyXL::Parser.parse_buffer t
=> #<RubyXL::Workbook:...
irb> RubyXL::Parser.parse_buffer t
Traceback (most recent call last):
...
        4: from .../rubyXL-3.4.25/lib/rubyXL/objects/ooxml_object.rb:116:in `parse'
        3: from .../nokogiri-1.12.5-x86_64-darwin/lib/nokogiri/xml.rb:36:in `parse'
        2: from .../nokogiri-1.12.5-x86_64-darwin/lib/nokogiri/xml/document.rb:72:in `parse'
        1: from .../nokogiri-1.12.5-x86_64-darwin/lib/nokogiri/xml/document.rb:72:in `read_io'
Nokogiri::XML::SyntaxError (1:1: FATAL: Document is empty)
$ ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-darwin20]
$ bundle exec gem list rubyXL
rubyXL (3.4.25)
@khiav223577
Copy link

I got the same error when parse file
get different error message with different nokogiri version

nokogiri-1.14.3

Nokogiri::XML::SyntaxError:
       1:1: FATAL: Document is empty

nokogiri-1.15.4

Nokogiri::XML::SyntaxError:
       1:1: FATAL: Growing input buffer

I added --enable-frozen-string-literal to RUBYOPT, remove it will fix the problem.
It looks like rubyXL doesn't support frozen-string-literal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants