3 import java.io.FileInputStream;
4 import java.io.InputStream;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
7 import org.xml.sax.InputSource;
8 import org.xml.sax.SAXException;
9 import com.icl.saxon.ExtendedInputSource;
14 * Copyright: Copyright (c) 2001
21 public class InputSourceResolver {
22 private static InputSourceResolver single = new InputSourceResolver();
23 private String prefix = "";
26 * InputSourceResolver constructor comment.
28 private InputSourceResolver() {
33 * Singleton Constructor
34 * @return de.matetrade.tools.InputSourceResolver
36 private static InputSourceResolver getInstance() {
41 * This method was created in VisualAge.
43 * @param key java.lang.String
45 private InputStream getFileInputStream( String key )
48 FileInputStream is = null;
50 is = new FileInputStream( prefix + key );
51 } catch ( FileNotFoundException ex ) {
52 throw new IOException( "FileNotFoundExcpetion: input for <" + key + "> not found" );
60 * This method was created in VisualAge.
61 * @return org.xml.sax.InputSource
62 * @param key java.lang.String
64 public static InputSource resolve( String key )
67 InputSource is = new InputSource( single.getFileInputStream( key ) );
68 if ( key.indexOf( ':' ) >= 0 ) {
69 is.setSystemId( "file:///" + key ); // special for win (file:///c:/xxx)
71 is.setSystemId( "file://" + key );