1 19 20 package org.netbeans.modules.apisupport.project; 21 22 import java.io.IOException ; 23 import java.net.URL ; 24 import java.util.HashMap ; 25 import java.util.Map ; 26 import org.openide.xml.EntityCatalog; 27 import org.xml.sax.InputSource ; 28 import org.xml.sax.SAXException ; 29 30 34 public final class FsDtdEntityCatalog extends EntityCatalog { 35 36 private final Map DTD_MAP = new HashMap (); 37 38 39 public FsDtdEntityCatalog() { 40 DTD_MAP.put("-//NetBeans//DTD Filesystem 1.0//EN", "org/openide/filesystems/filesystem.dtd"); 41 DTD_MAP.put("-//NetBeans//DTD Filesystem 1.1//EN", "org/openide/filesystems/filesystem1_1.dtd"); 42 } 43 44 public InputSource resolveEntity(String publicId, String systemId) throws SAXException , IOException { 45 String resourcePath = (String ) DTD_MAP.get(publicId); 46 if (resourcePath == null) { 47 return null; 48 } 49 URL location = FsDtdEntityCatalog.class.getClassLoader().getResource(resourcePath); 50 assert location != null : resourcePath; 51 return new InputSource (location.toExternalForm()); 52 } 53 54 } 55 | Popular Tags |