Skip to content

SAX: Locator#getSystemId and Locator#getPublicId are not available during startDocument event #213

@philippn

Description

@philippn

Hi there,

I have been looking at the SAX parsing again and noticed that there is another tiny problem. Basically it occurs, when you try to access the Locator properties during the startDocument event. Here the systemId can be useful in particular, but since the mScanner is not initialized yet, null is returned instead.

A simple solution is to defer the startDocument and setLocator calls until after the mScanner is initialized.

I have implemented this in a branch (https://github.com/philippn/woodstox/tree/bugfix/fix-locator-for-saxon), tested it and could provide a PR if you are interested (although it's really quite trivial).

Thanks in advance and kind regards,
Philipp

Metadata

Metadata

Assignees

No one assigned

    Labels

    SAXIssue/pr related to SAX API implementation (as opposed to StAX)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions