Repository navigation
Conversation
Roo::Utils.each_element compared Nokogiri::XML::Reader#name, the qualified name, against the element names it was asked for. Worksheets serialized with an explicit namespace prefix (<x:row> rather than <row>, as emitted by the OpenXML SDK and ClosedXML) therefore matched nothing: each_row_streaming yielded zero rows with no error, while the non-streaming reader parsed the same file correctly. extract_dimensions missed for the same reason. Compare local_name instead. Unprefixed documents are unaffected, since local_name and name are equal when there is no prefix, and nothing downstream changes: a matched node is re-parsed into a DOM where Nokogiri already reports local names, which is why cell_from_xml's 'is'/'f'/'v' cases were always prefix-agnostic. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #642.
Roo::Utils.each_elementmatchedNokogiri::XML::Reader#name— the qualified name — against the element names it was asked for. Worksheets serialized with an explicit namespace prefix (<x:row>rather than<row>, as emitted by the OpenXML SDK and ClosedXML) therefore matched nothing, soeach_row_streamingyielded zero rows with no error while the non-streaming reader parsed the same file correctly:SheetDoc#extract_dimensionsmissed for the same reason.The change
One line — compare
local_nameinstead ofname.Nothing downstream needed changing. A matched node is re-parsed with
Nokogiri::XML(node.outer_xml).root, and Nokogiri reports local names on that DOM, which is whycell_from_xml'scase cell.name when 'is' / 'f' / 'v'was already prefix-agnostic.Unprefixed documents are unaffected:
local_name == namewhen there is no prefix.Reader#local_nameis available across the entirenokogiri ~> 1range the gemspec allows, so there is no compatibility caveat.Tests
test/files/prefixed_namespace.xlsxis a new 3-row fixture whose workbook and worksheet parts are written with thex:prefix. Two examples are added under the existing#each_row_streamingdescribe block: one asserting every row is yielded, one asserting the streaming and non-streaming readers agree on row count.Verified both directions:
lib/roo/utils.rbfails the two new examples withgot: []andexpected: 3, got: 0.🤖 Generated with Claude Code