Permalink
Browse files

Fix issue #131 by using the Saxon unparsed text resolver if there isn…

…'t another one
  • Loading branch information...
ndw committed Nov 26, 2013
1 parent 84d40b1 commit f31ff67de0800f36503cd38e79fa27d19582332b
Showing with 6 additions and 12 deletions.
  1. +6 −12 src/com/xmlcalabash/util/XProcURIResolver.java
@@ -2,6 +2,7 @@
import net.sf.saxon.lib.ModuleURIResolver;
import net.sf.saxon.lib.StandardModuleURIResolver;
+import net.sf.saxon.lib.StandardUnparsedTextResolver;
import net.sf.saxon.lib.UnparsedTextURIResolver;
import net.sf.saxon.trans.XPathException;
import org.xml.sax.InputSource;
@@ -262,19 +263,12 @@ public InputSource resolveEntity(String publicId, String systemId) throws SAXExc
}
@Override
- public Reader resolve(URI uri, String s, Configuration configuration) throws XPathException {
- if (unparsedTextResolver != null) {
- return unparsedTextResolver.resolve(uri, s, configuration);
+ public Reader resolve(URI uri, String encoding, Configuration configuration) throws XPathException {
+ if (unparsedTextResolver == null) {
+ // If there's no resolver, let Saxon do it...
+ unparsedTextResolver = new StandardUnparsedTextResolver();
}
- // Ack. Apparently I have to do this if there isn't a resolver...
- try {
- URL url = uri.toURL();
- URLConnection conn = url.openConnection();
- InputStream stream = conn.getInputStream();
- return new InputStreamReader(stream);
- } catch (Exception e) {
- throw new XPathException(e);
- }
+ return unparsedTextResolver.resolve(uri, encoding, configuration);
}
}

0 comments on commit f31ff67

Please sign in to comment.