Skip to content

Initialize the document locator before starting tokenization#124

Open
sideshowbarker wants to merge 1 commit into
masterfrom
fix-null-document-system-id
Open

Initialize the document locator before starting tokenization#124
sideshowbarker wants to merge 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.

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
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.

1 participant