Package javax.xml.transform

Examples of javax.xml.transform.URIResolver


      return transformer;
   }
      
   private static Transformer newTransformer(String filename, ClassLoader cl) throws Exception {
      final String systemId = null;
      final URIResolver uriResolver = null;
      final Map map = null;
      String xslt = getXslStringFromFile(filename, cl);
      return newTransformer(systemId, xslt, uriResolver, map);
   }
View Full Code Here


   
    final Configuration config = staticContext.getConfiguration();
    if (resolver == null) resolver = new DefaultDocumentURIResolver(config);
    final DocumentURIResolver myResolver = resolver;
    config.setURIResolver(
      new URIResolver() {
        public Source resolve(String href, String baseURI) throws TransformerException {
          try {
            Document doc = myResolver.resolve(href, baseURI);
            if (doc == null) { // fallback to default mechanism
              doc = new DefaultDocumentURIResolver(config).resolve(href, baseURI);
View Full Code Here

      PrintTraceListener tracer = null;
      String outputType = null;
      String media = null;
      Vector params = new Vector();
      boolean quietConflictWarnings = false;
      URIResolver uriResolver = null;
      EntityResolver entityResolver = null;
      ContentHandler contentHandler = null;
      int recursionLimit=-1;

      for (int i = 0; i < argv.length; i++)
View Full Code Here

      PrintTraceListener tracer = null;
      String outputType = null;
      String media = null;
      Vector params = new Vector();
      boolean quietConflictWarnings = false;
      URIResolver uriResolver = null;
      EntityResolver entityResolver = null;
      ContentHandler contentHandler = null;
      int recursionLimit=-1;

      for (int i = 0; i < argv.length; i++)
View Full Code Here

  /**
   * Constructs the default {@link TransformerBuilder}.
   */
  protected TransformerBuilder createTransformerBuilder(URIResolver resolver) {
    //return new CachingTransformerBuilder(new DefaultTransformerBuilder(resolver));
    URIResolver resolver1 = new GlossaryResolver(new DocBookResolver (resolver, getType()), getType());
    return new CachingTransformerBuilder(new DefaultTransformerBuilder(resolver1));
  }
View Full Code Here

    final String[] included = scanIncludedFiles();
    // configure a resolver for catalog files
    final CatalogManager catalogManager = createCatalogManager();
    final CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
    // configure a resolver for urn:dockbx:stylesheet
    final URIResolver uriResolver = createStyleSheetResolver(catalogResolver);

    // configure a resolver for xml entities
    final InjectingEntityResolver injectingResolver = createEntityResolver(catalogResolver);

    EntityResolver resolver = catalogResolver;
View Full Code Here

   * @param catalogResolver The initial resolver to use
   * @return The Stylesheet resolver.
   * @throws MojoExecutionException If an error occurs while reading the stylesheet
   */
  private URIResolver createStyleSheetResolver(CatalogResolver catalogResolver) throws MojoExecutionException {
    URIResolver uriResolver;
    try {     
      URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL() : getNonDefaultStylesheetURL();
      if (getLog().isDebugEnabled()) {
          getLog().debug("Using stylesheet: " + url.toExternalForm());
      }
View Full Code Here

  public EntityResolver asEntityResolver() {
    return this;
  }
 
  public URIResolver asURIResolver() {
    return new URIResolver() {
      public Source resolve(String href, String base) throws TransformerException {
        try {
          final InputSource src = SystemIdResolver.this.resolveEntity(null, null, base, href);
          return (src == null) ? null : new SAXSource(src);
        } catch (IOException ioe) {
View Full Code Here

     * Test the URIResolver contract if the protocol doesn't match. Resolver must return null
     * in this case.
     * @throws Exception if an error occurs
     */
    public void testNonMatchingContract() throws Exception {
        URIResolver resolver = new DataURIResolver();
        Source src;
       
        src = resolver.resolve("http://xmlgraphics.apache.org/fop/index.html", null);
        assertNull(src);

        src = resolver.resolve("index.html", "http://xmlgraphics.apache.org/fop/");
        assertNull(src);
    }
View Full Code Here

    /**
     * Test the DataURIResolver with correct values.
     * @throws Exception if an error occurs
     */
    public void testDataURLHandling() throws Exception {
        URIResolver resolver = new DataURIResolver();
        Source src;
       
        src = resolver.resolve("data:;base64,AAECAwQF", null);
        assertNotNull(src);
        StreamSource streamSource = (StreamSource)src;
        byte[] data = IOUtils.toByteArray(streamSource.getInputStream());
        assertTrue("Decoded data doesn't match the test data", byteCmp(TESTDATA, 0, data));

        src = resolver.resolve(
                "data:application/octet-stream;interpreter=fop;base64,AAECAwQF", null);
        assertNotNull(src);
        streamSource = (StreamSource)src;
        assertNotNull(streamSource.getInputStream());
        assertNull(streamSource.getReader());
        data = IOUtils.toByteArray(streamSource.getInputStream());
        assertTrue("Decoded data doesn't match the test data", byteCmp(TESTDATA, 0, data));

        src = resolver.resolve("data:,FOP", null);
        assertNotNull(src);
        streamSource = (StreamSource)src;
        assertNull(streamSource.getInputStream());
        assertNotNull(streamSource.getReader());
        String text = IOUtils.toString(streamSource.getReader());
View Full Code Here

TOP

Related Classes of javax.xml.transform.URIResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.