1 16 17 package org.pentaho.repository; 18 19 import java.io.FileInputStream ; 20 import java.io.FileNotFoundException ; 21 import java.io.IOException ; 22 23 import org.pentaho.core.system.PentahoSystem; 24 import org.xml.sax.EntityResolver ; 25 import org.xml.sax.InputSource ; 26 import org.xml.sax.SAXException ; 27 28 public class PentahoEntityResolver implements EntityResolver { 29 30 36 public InputSource resolveEntity(String publicId, String systemId) throws SAXException , IOException { 37 38 int idx = systemId.lastIndexOf('/'); 39 String dtdName = systemId.substring(idx + 1); 40 String fullPath = PentahoSystem.getApplicationContext().getSolutionPath("system/dtd/" + dtdName); 42 try { 43 FileInputStream xslIS = new FileInputStream (fullPath); 44 InputSource source = new InputSource (xslIS); 45 return source; 46 } catch (FileNotFoundException e) { 47 48 } 49 return null; 50 } 51 52 } 53 | Popular Tags |