EntityResolver Example

import org.xml.sax.*;

public class RSSResolver implements EntityResolver {

  public InputSource resolveEntity(String publicId, String systemId) {

    if ( publicId.equals(
          "-//Netscape Communications//DTD RSS 0.91//EN")
     || systemId.equals(
          "http://my.netscape.com/publish/formats/rss-0.91.dtd")) {
      return new InputSource(
       "http://www.ibiblio.org/xml/dtds/rss.dtd");
    } 
    else {
      // use the default behaviour
      return null;
    }
    
  }
   
}
 

Previous | Next | Top | Cafe con Leche

Copyright 2000, 2001 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 6, 2000