-
-
Notifications
You must be signed in to change notification settings - Fork 935
Closed
Labels
Description
Discussed in #2675
Originally posted by ShockwaveNN October 20, 2022
Hi, trying to port one of my library for parsing ooxml to jruby and I got a problem
I got this XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<bookViews>
<workbookView r:xWindow="360" yWindow="15" windowWidth="20955"
windowHeight="9720" activeTab="0"/>
</bookViews>
</workbook>
And simplified ruby code to parse it:
require 'nokogiri'
xml = Nokogiri::XML(File.open('example.xml'), &:strict)
xml.xpath('xmlns:workbook/xmlns:bookViews/xmlns:workbookView').each do |sheet|
puts sheet.attribute('xWindow').value
end
On mruby this output 360
But on jruby it just crash with:
NoMethodError: undefined method `value' for nil:NilClass
If I change puts to
puts sheet.attribute('r:xWindow').value
It works correctly on both rubies
I understand that mruby and jruby uses different XML parser
Is there any option to jruby to make parsing of such attributes same as on jruby or proper way will be to fix my codebase by adding r: namespace?
Reactions are currently unavailable