DTD validation is always relative to DTD specified by DOCTYPE.
Sometimes you need to check a document that has no DOCTYPE.
Sometimes you want to substitute a different DTD
Use an EntityResolver
import org.xml.sax.*;
import java.io.*;
public class LocalResolver implements EntityResolver {
public InputSource resolveEntity (String publicID, String systemID)
{
if (publicID.equals("-//Apple Computer//DTD PLIST 1.0//EN")) {
InputStream in = new FileInputStream("plist.dtd");
return new InputSource(in);
}
else {
return null;
}
}
}