Listing 9. Resolving all NHLcopyright entities the same way
package com.developerWorks.xml.util;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
public class CommonResolver implements EntityResolver {
public void resolveEntity(String publicID, String systemID)
throws SAXException {
// Look for the NHLCopyright system ID
if ((systemID.equals("http://www.nhl.com/nhlCopyright.xml")) ||
(systemID.equals("http://www.dallasStars.com/nhl/copyright.xml"))) {
// You could add other system IDs for comparison here, as well
return new InputSource("myLocalCopyright.xml");
}
// In all other cases, return null
return null;
}
} |
