/** * This method implements XSLTC's SourceLoader interface. It is used to * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ public InputSource loadSource(String href, String context, XSLTC xsltc) { try { // A _uriResolver must be set if this method is called final Source source = _uriResolver.resolve(href, context); if (source != null) { return Util.getInputSource(xsltc, source); } } catch (TransformerException e) { // Falls through } return null; }
/** * This will be called by the processor when it encounters * an xsl:include, xsl:import, or document() function. * * @param base The base URI that should be used. * @param urlString Value from an xsl:import or xsl:include's href attribute, * or a URI specified in the document() function. * * @return a Source that can be used to process the resource. * * @throws IOException * @throws TransformerException */ public Source resolveURI( String base, String urlString, SourceLocator locator) throws TransformerException, IOException { Source source = null; if (null != m_uriResolver) { source = m_uriResolver.resolve(urlString, base); } if (null == source) { String uri = SystemIDResolver.getAbsoluteURI(urlString, base); source = new StreamSource(uri); } return source; }
/** * This method implements XSLTC's SourceLoader interface. It is used to * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ public InputSource loadSource(String href, String context, XSLTC xsltc) { try { if (_uriResolver != null) { final Source source = _uriResolver.resolve(href, context); if (source != null) { return Util.getInputSource(xsltc, source); } } } catch (TransformerException e) { // Falls through } return null; }
/** * This will be called by the processor when it encounters * an xsl:include, xsl:import, or document() function. * * @param base The base URI that should be used. * @param urlString Value from an xsl:import or xsl:include's href attribute, * or a URI specified in the document() function. * * @return a Source that can be used to process the resource. * * @throws IOException * @throws TransformerException */ public Source resolveURI( String base, String urlString, SourceLocator locator) throws TransformerException, IOException { Source source = null; if (null != m_uriResolver) { source = m_uriResolver.resolve(urlString, base); } if (null == source) { String uri = SystemIDResolver.getAbsoluteURI(urlString, base); source = new StreamSource(uri); } return source; }
source = m_uriResolver.resolve(href, m_baseID);
source = m_uriResolver.resolve(href, m_baseID);
Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource(
/** * Get the Source object for the included or imported stylesheet module * obtained from the user's URIResolver, if there is no user provided * URIResolver null is returned. */ private Source getSourceFromUriResolver(StylesheetHandler handler) throws TransformerException { Source s = null; TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); if (uriresolver != null) { String href = getHref(); String base = handler.getBaseIdentifier(); s = uriresolver.resolve(href,base); } return s; }
/** * Get the Source object for the included or imported stylesheet module * obtained from the user's URIResolver, if there is no user provided * URIResolver null is returned. */ private Source getSourceFromUriResolver(StylesheetHandler handler) throws TransformerException { Source s = null; TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); if (uriresolver != null) { String href = getHref(); String base = handler.getBaseIdentifier(); s = uriresolver.resolve(href,base); } return s; }
@Override public Source resolve(String href, String base) throws TransformerException { try { if (href.startsWith("http://") || href.startsWith("https://")) { if (alt != null) { Source s = alt.resolve(href, base); if (s != null) return s; } return TransformerFactory.newInstance().getURIResolver().resolve(href, base); } else return new StreamSource(new FileInputStream(href.contains(File.separator) ? href : path+href)); } catch (FileNotFoundException e) { throw new TransformerException(e); } }
@Override public Source resolve(String href, String base) throws TransformerException { try { if (href.startsWith("http://") || href.startsWith("https://")) { if (alt != null) { Source s = alt.resolve(href, base); if (s != null) return s; } return TransformerFactory.newInstance().getURIResolver().resolve(href, base); } else return new StreamSource(new FileInputStream(href.contains(File.separator) ? href : Utilities.path(path, href))); } catch (FileNotFoundException e) { throw new TransformerException(e); } catch (IOException e) { throw new TransformerException(e); } }
/** * @param href an href * @param base a base * @return a source * @throws TransformerException if not caught * @deprecated * @see org.apache.xmlgraphics.util.uri.DataURIResolver#resolve(String, * String) */ public Source resolve(String href, String base) throws TransformerException { return newResolver.resolve(href, base); }
@Override public Source resolve(String href, String base) throws TransformerException { Source res = null; for(URIResolver resolver: this.resolvers) { try { synchronized(resolver) { res = resolver.resolve(href, base); if(res != null) { break; } } } catch(TransformerException e) { // do nothing } } return res; }
@Override public Source resolve(String href, String base) throws TransformerException { Source res = null; for(URIResolver resolver: this.resolvers) { try { synchronized(resolver) { res = resolver.resolve(href, base); if(res != null) { break; } } } catch(TransformerException e) { // do nothing } } return res; }
@Override public Source resolve(final String href, final String base) throws TransformerException { System.out.println("XSLT parse: " + href); return r.resolve(href, base); } }
@Override public Source resolve(String href, String base) throws TransformerException { if (href != null && href.startsWith("file:")) { return this._resolver.resolve(href, base); } else { return new StreamSource(); } } }
@Override public Source resolve(String href, String base) throws TransformerException { if (href.endsWith("eudml-utils.xsl")){ return new StreamSource(this.getClass().getResourceAsStream(eudmlUtils)); } if (href.endsWith("eudml-lang.xml")){ return new StreamSource(this.getClass().getResourceAsStream(eudmlLang)); } return baseResolver.resolve(href, base); }
public Source resolve(String href, String base) throws TransformerException { int idx; String ref; if (href.contains(":")) { ref = href; } else { idx = base.lastIndexOf('/'); if (idx == -1) { ref = href; } else { ref = base.substring(0, idx) + "/" + href; } } return defaultResolver == null ? null : defaultResolver.resolve(ref, base); } }
@Nullable public final Source resolve (final String sHref, final String sBase) throws TransformerException { final Source aSource = internalResolve (sHref, sBase); if (aSource != null) return aSource; // Nothing found -> call wrapped resolver (if any) if (m_aWrappedURIResolver != null) return m_aWrappedURIResolver.resolve (sHref, sBase); // Nothing to resolve return null; }
@Override public Source resolve(String href, String base) throws TransformerException { InputStream stream = ClassPathURIResolver.class.getClassLoader() .getResourceAsStream(rulesDir.concat("/").concat(href)); if (stream != null) { return new StreamSource(stream); } else { if (clientUriResolver != null) { return clientUriResolver.resolve(href, base); } else { return new StreamSource(stream); } } } }