This commit updates fallback-related checks and refactors the code used
for checking references to publication resources.
The following checks are introduced or updated:
- `RSC-032` (new): reports foreign resources with no fallback used in
content documents. Replaces `MED-001`, `MED-002`, and `CSS-010`
- `MED-003` now reports when an `img` element child of a `picture` element
is not a core media type.
- `MED-001` is suppressed. It was used to report a video `poster` attribute
did not reference a core image media type. It is now reported as `RSC-032`.
- `MED-002` is suppressed. It was used to report HTML elements referencing
foreign resources without fallback. It is now reported as `RSC-032`.
- `CSS-010` is suppressed. It was used to report references to foreign
stylesheets with no fallback. It is now reported as `RSC-032`.
- `OPF_040` is now reported when the `fallback` attribute of a package
document `item` element does not points to an existing ID. This was
previously implemented as a Schematron check (`RSC-005`) in EPUB 3.x.
- `OPF-013` is now a warning. It is reported when a MIME type declared
inline in content (for instance with an HTML `type` attribute) does
not match the MIME type declared in the package document.
The code is refactored as follows:
- the reference/resource registry functionality of the `XRefChecker`
class is extracted to new top-level classes in the (new) package
`org.w3c.epubcheck.references`.
- `Resource` represents a publication resource
- `ResourceRegistry` is a registry of `Resource` instances
- `Reference` represents a reference (URL) used anywhere in content
- `ReferenceRegistry` is a registry of `Reference` instances
- `XRefChecker` is renamed to `ResourceReferencesChecker`.
- `ValidationContext` contains optional references to `ResourceRegistry`
and `ReferenceRegistry`.
- fallback chain resolution is now done in a new `FallbackChainResolver`
class, when building `OPFItem` instances from the builders created
when parsing the package document.
- `XMLHandler` has convenience methods used to register references
to the `ReferenceRegistry`.
Fix #1304, Fix #1298.