FileDocCategorySizeDatePackage
MyDTDResolver.javaAPI DocExample1203Sun Feb 29 21:42:58 GMT 2004None

MyDTDResolver

public class MyDTDResolver extends Object implements EntityResolver

Fields Summary
public static final String[]
dtds
public static final String
DTDDIR
Constructors Summary
Methods Summary
public org.xml.sax.InputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId)


	       
		for (int i=0; i<dtds.length; i++) {
			if (systemId.equals(dtds[i])) {
				// return a local copy
				try {
					String dtdFile = 
						systemId.substring(systemId.lastIndexOf('/"));
						// includes the /
					return new InputSource(
						new FileReader(DTDDIR + dtdFile));
				} catch (IOException ex) {
					System.err.println("+================================+");
					System.err.println("DTD ERROR: " + ex.toString());
					System.err.println("... Trying to get from web...");
					System.err.println("+================================+");
					return null;
				}
			}
		}
		// Not matched any of the ones in the array.
		return null;