Java by API/org.xml.sax/EntityResolver — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 20:43, 31 мая 2010

implements EntityResolver

   <source lang="java">
 

import org.xml.sax.EntityResolver; import java.io.IOException; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class SimpleEntityResolver implements EntityResolver {

 private static final String USAGE_TERMS_ID = "http://www.n.ru/t.xml";
 private static final String USAGE_TERMS_LOCAL_URI = "C:\\t.xml";
 public InputSource resolveEntity(String publicID, String systemID) throws IOException,
     SAXException {
   if (systemID.equals(USAGE_TERMS_ID)) {
     return new InputSource(USAGE_TERMS_LOCAL_URI);
   }
   return null;
 }

}


 </source>