*/
public FOFileHandler(File fofile) {
this.fofile = fofile;
+ setBaseURL(fofile);
}
/**
*/
public abstract InputSource getInputSource();
+ protected String baseURL = null;
+
+ /**
+ * Get the base URL associated with this input source
+ * @return the input source
+ */
+ public String getBaseURL() {
+ return baseURL;
+ }
+
+ /**
+ * Attempts to set a default base URL from the parent of the file passed
+ * as an argument. Sets <code>baseURL</code> to the URL derived, or to an
+ * empty string if that fails.
+ * @param file
+ */
+ protected void setBaseURL(File file) {
+ try {
+ baseURL =
+ new File(file.getAbsolutePath()).getParentFile().toURL().toExternalForm();
+ } catch (Exception e) {
+ baseURL = "";
+ }
+ }
+
/**
* Get the SAX parser associated with this input handler.
* @return the SAX parser
public XSLTInputHandler(File xmlfile, File xsltfile, Vector params) {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ setBaseURL(xmlfile);
xsltParams = params;
}
public XSLTInputHandler(File xmlfile, File xsltfile) {
this.xmlSource = new StreamSource(xmlfile);
this.xsltSource = new StreamSource(xsltfile);
+ setBaseURL(xmlfile);
}
/**
// Java
import java.util.Map;
+import java.util.logging.Logger;
import java.io.InputStream;
-// Avalon
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
/**
* The User Agent for fo.
* These areas may contain resolveable areas that will be processed
* with other resolveable areas
*/
-public class FOUserAgent implements LogEnabled {
+public class FOUserAgent {
private Logger log;
/** Map containing various default values */
/**
* Sets the logger.
* @param log Logger to use
- * @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(Logger)
*/
public void enableLogging(Logger log) {
this.log = log;