Skip to content

Initialize the document locator before starting tokenization - #124

Merged
sideshowbarker merged 1 commit into
masterfrom
fix-null-document-system-id
Jul 31, 2026
Merged

Initialize the document locator before starting tokenization#124
sideshowbarker merged 1 commit into
masterfrom
fix-null-document-system-id

Conversation

@sideshowbarker

@sideshowbarker sideshowbarker commented Jul 19, 2026

Copy link
Copy Markdown
Member

Problem: When a caller supplies its own ContentHandler, the Document system identifier is null.

Cause: tokenizer.initLocation() wasn’t getting called until after Driver.tokenize() called tokenizer.start(). So the tokenizer’s systemId/publicId were still null when start() delivered the first SAX events.

Fix: Call initLocation() before start(). The locator carries the input source’s public/system IDs before any downstream handler observes it. Fixes #123.

@sideshowbarker
sideshowbarker requested a review from hsivonen July 19, 2026 01:37

@hsivonen hsivonen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Problem: When a caller supplies its own ContentHandler, the Document
system identifier is null.

Cause: tokenizer.initLocation() wasn’t getting called until after
Driver.tokenize() called tokenizer.start(). So the tokenizer’s systemId/
publicId were still null when start() delivered the first SAX events.

Fix: Call initLocation() before start(). The locator carries the input
source’s public/system IDs before any downstream handler observes it.

Fixes #123
@sideshowbarker
sideshowbarker force-pushed the fix-null-document-system-id branch from 70fe59f to 00e39e2 Compare July 31, 2026 14:33
@sideshowbarker
sideshowbarker merged commit 41e32be into master Jul 31, 2026
12 checks passed
@sideshowbarker
sideshowbarker deleted the fix-null-document-system-id branch July 31, 2026 14:36
@ndw

ndw commented Jul 31, 2026

Copy link
Copy Markdown

Thank you!

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.

The Document system identifier is null if you provide your own content handler.

3 participants