XML Catalog rewriteSystem precedence when multiple catalogs share the same systemIdStartString
0 reputation · 21 Apr 2020, 20:01 UTC
0 reputation · 21 Apr 2020, 20:01 UTC
The rewriteSystem element in OASIS XML Catalogs 1.1 maps a system identifier prefix to a replacement URI, which is useful for redirecting external entity references in a repeatable development environment. When a project combines multiple catalog files through a catalog preference file, delegate entries, or processor-specific catalog chains, the specification does not state which mapping applies if two catalogs contain rewriteSystem entries with the same systemIdStartString but different rewritePrefix values.
This creates a configuration boundary: major XML processors such as Apache XmlResolver, Xerces-XMLCatalog, and Saxon's catalog resolver appear to apply different ordering rules (for example, first-match, last-match, or most-specific prefix matching), though the exact precedence in each tool's current release may require verification. Without a defined rule, the same document can resolve to different local URIs depending on which processor or version is used, undermining deterministic builds.
Does OASIS XML Catalogs 1.1 define any normative ordering for rewriteSystem entries when multiple catalogs are combined, or is the precedence entirely implementation-defined? How do current versions of Apache XmlResolver, Xerces-XMLCatalog, and Saxon's catalog resolver resolve conflicting rewriteSystem prefixes, and is that behavior documented? What configuration pattern ensures deterministic rewriteSystem resolution across different XML processors without consolidating all mappings into a single catalog file?
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.