Skip to content

Add a schemaLanguage parameter to XmlFactories.newSchemaFactory - #32

Open
ppkarwasz wants to merge 3 commits into
mainfrom
feature/schema-factory-language
Open

Add a schemaLanguage parameter to XmlFactories.newSchemaFactory#32
ppkarwasz wants to merge 3 commits into
mainfrom
feature/schema-factory-language

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

Why

XmlFactories.newSchemaFactory() hardcoded W3C XML Schema, while the JAXP API it wraps, SchemaFactory.newInstance(String), lets the caller pick the schema language. Since the library is unreleased there is no compatibility to preserve, so the method itself gains the parameter instead of an overload.

What

  • XmlFactories.newSchemaFactory(String schemaLanguage) passes the language through to SchemaFactory.newInstance(String) and propagates its IllegalArgumentException/NullPointerException contract. The hardening is enforced through the factory's LSResourceResolver hook and hardened source rewriting rather than any implementation-specific setting, so the documented guarantees hold for whichever schema language JAXP locates a factory for.
  • Call sites in the tests and the site index snippet pass XMLConstants.W3C_XML_SCHEMA_NS_URI.
  • SchemaFactoryLanguageTest covers the language-selection contract (an unsupported language surfaces IllegalArgumentException); the working W3C path is exercised by the whole schema suite.

Testing

Full surefire matrix green (84 reports, zero failures); the new test runs in the schema-tagged executions.

🤖 Generated with Claude Code

Mirror SchemaFactory.newInstance(String): the caller picks the schema
language instead of the method hardcoding W3C XML Schema. The hardening
is enforced through the LSResourceResolver hook and hardened source
rewriting rather than any implementation-specific setting, so it holds
for whichever schema language JAXP locates a factory for.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
@garydgregory

Copy link
Copy Markdown
Member

@ppkarwasz
In the future, please use your own fork for PRs, otherwise we might be left with stale branches and who knows what in the canonical repository.

@ppkarwasz

Copy link
Copy Markdown
Member Author

I recently switched to apache because PRs in the same repository can be stacked, while PRs from forks cannot. #23 and #24 were different: workflow changes cannot be tested from a fork before merging.

I know you prefer avoiding branches in apache, so I only use them for stacked PRs or workflow changes. Enabling delete_branch_on_merge should prevent stale branches, and GitHub makes unlinked branches easy to identify and remove.

XMLConstants is no longer referenced from XmlFactories.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
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