Changeset 5979


Ignore:
Timestamp:
2003-11-25T16:08:35+13:00 (20 years ago)
Author:
kjdon
Message:

changed this completely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSEntityResolver.java

    r5962 r5979  
    1010public class GSEntityResolver implements EntityResolver {
    1111
    12     //public GSEntityResolver() {
    13     ///ystem.out.println("creating entity resolver");
    14     //}
    1512    public InputSource resolveEntity (String public_id, String system_id) {
    1613   
    1714    System.out.println("entity resolver for "+system_id);
    18     if (system_id.endsWith(".dtd") && system_id.indexOf("jakarta")!=-1) {
    19         int index = system_id.lastIndexOf(File.separatorChar);
    20         if (index != -1) {
    21         system_id = system_id.substring(index+1);
    22        
     15    String temp_id = system_id;
     16    if (temp_id.startsWith("file://")) {
     17        File f = new File(system_id);
     18        if (f.exists()) {
     19        return new InputSource(system_id);
     20        } else {
     21        temp_id = temp_id.substring(temp_id.lastIndexOf(File.separator)+1);
    2322        }
    24     } else if (system_id.endsWith(".dtd") && system_id.indexOf(File.separatorChar)==-1) {
    25        
    2623    } else {
    27         return null;
     24        if (temp_id.indexOf(File.separatorChar)!= -1) {
     25        temp_id = temp_id.substring(temp_id.lastIndexOf(File.separator)+1);
     26        }
    2827    }
    29     System.out.println("using class loader for "+system_id);
    30     URL url = ClassLoader.getSystemResource(system_id);
     28   
     29    System.out.println("using class loader for "+temp_id);
     30    URL url = ClassLoader.getSystemResource(temp_id);
    3131    if (url == null) {
    3232        System.out.println("class loader didn't find it");
     
    3535    return new InputSource("file://"+url.getFile());
    3636    }
     37
    3738}
Note: See TracChangeset for help on using the changeset viewer.