Package javax.xml.transform

Examples of javax.xml.transform.URIResolver


    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = super.createRegistry();
        URIResolver customURIResolver = getCustomURIResolver();
        registry.bind("customURIResolver", customURIResolver);
        return registry;
    }
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

      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

  protected void parse(
          StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
            throws org.xml.sax.SAXException
  {
    TransformerFactoryImpl processor = handler.getStylesheetProcessor();
    URIResolver uriresolver = processor.getURIResolver();

    try
    {
      Source source = null;

      if (null != uriresolver)
      {
        source = uriresolver.resolve(getHref(),
                                     handler.getBaseIdentifier());

        if (null != source && source instanceof DOMSource)
        {
          Node node = ((DOMSource)source).getNode();
View Full Code Here

    public void testSVGWithDOM() throws Exception {
        String uri = "my:SVGImage";
        FOUserAgent userAgent = fopFactory.newFOUserAgent();
       
        userAgent.setURIResolver(new URIResolver() {

            public Source resolve(String href, String base) throws TransformerException {
                if (href.startsWith("my:")) {
                    DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
                    String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
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

  protected void parse(
          StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
            throws org.xml.sax.SAXException
  {
    TransformerFactoryImpl processor = handler.getStylesheetProcessor();
    URIResolver uriresolver = processor.getURIResolver();

    try
    {
      Source source = null;

      if (null != uriresolver)
      {
        source = uriresolver.resolve(getHref(),
                                     handler.getBaseIdentifier());

        if (null != source && source instanceof DOMSource)
        {
          Node node = ((DOMSource)source).getNode();
View Full Code Here

    public ImageSessionContextTestCase(String name) {
        super(name);
    }

    public void testStreamSourceWithSystemID() throws Exception {
        URIResolver resolver = new URIResolver() {
            public Source resolve(String href, String base) throws TransformerException {
                if (href.startsWith("img:")) {
                    String filename = href.substring(4);
                    return new StreamSource(base + filename);
                } else {
View Full Code Here

        ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
        assertTrue(imgSrc.isFastSource()); //Access through local file system
    }

    public void testStreamSourceWithInputStream() throws Exception {
        URIResolver resolver = new URIResolver() {
            public Source resolve(String href, String base) throws TransformerException {
                if (href.startsWith("img:")) {
                    String filename = href.substring(4);
                    try {
                        return new StreamSource(new java.io.FileInputStream(
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.