Skip to content

Stream rows from a worksheet that prefixes its elements - #11

Merged
almasumdev merged 2 commits into
almasumdev:mainfrom
cdeil:stream-prefix
Oct 16, 2026
Merged

almasumdev merged 2 commits into
almasumdev:mainfrom
cdeil:stream-prefix

Conversation

@cdeil

@cdeil cdeil commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Problem. 2.28.0 taught the eager reader to read a part that prefixes
every element (<x:sheetData>), but streamRows still searched for a
literal <sheetData, so for such a file it yields no rows while
excel['Sheet1'] reads the cells fine. streamRowsAsMaps inherits it.

Fix. Locate sheetData through lazy XML events, then yield its rows
and stop at the closing event. Local-name matching handles prefixes, XML
comments cannot masquerade as tags, and legal closing-tag whitespace works.
No worksheet DOM or additional substring copy is created, so streaming
retains its memory bound. This avoids normalizing/re-serializing the worksheet.

Validation. test/sheet_stream_test.dart, "Streaming Namespace Parity":
a fully prefixed worksheet streams its cell, a prefixed empty
<x:sheetData/> yields no rows, legal closing-tag whitespace works, and a
comment containing a prefixed tag does not hide the real data. The added
whitespace/comment cases fail on the initial fix and pass with the event
walk. Existing streaming and namespace suites pass.

🤖 Generated with Claude Code

cdeil and others added 2 commits October 16, 2026 14:35
streamRows looked for a literal <sheetData, so a part written as
<x:sheetData> (the form the eager reader learned in 2.28.0) yielded no
rows at all while excel['Sheet1'] read the same cells fine. The tag is
now found with whatever prefix it carries; the cell walk already
compared local names, and the part is still never parsed as a tree, so
the memory profile of streaming is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@almasumdev
almasumdev merged commit f785572 into almasumdev:main Oct 16, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants