20 package net.sf.gridarta.utils.xml;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
26 import org.xml.sax.EntityResolver;
27 import org.xml.sax.InputSource;
28 import org.xml.sax.SAXException;
62 public InputSource
resolveEntity(@Nullable
final String publicId, @NotNull
final String systemId)
throws SAXException, IOException {
63 if (!systemId.equals(
this.systemId) && !systemId.endsWith(
"/" + this.systemId)) {
64 throw new SAXException(
"unsupported system ID '" + systemId +
"'");
67 if (inputStream == null) {
68 throw new IOException(
"the resource '" + resourceName +
"' does not exist");
70 return new InputSource(inputStream);
InputSource resolveEntity(@Nullable final String publicId, @NotNull final String systemId)
FixedDtdEntityResolver(@NotNull final String systemId, @NotNull final String resourceName)
Creates a new instance.
final String systemId
The expected system ID.
final String resourceName
The name of the resource to return for systemId.