Examples of SAXSVGDocumentFactory


Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

   
    @Test
    public void testParseSVG() throws Exception {
        URL url = GeoToolsTest.class.getResource("example.svg");
        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        f.createDocument(url.toString());
    }
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

    // the following is necessary so that batik knows how to resolve URI fragments
    // (#myLinearGradient). Otherwise the resolution fails and you cannot render.
   
    String uri = "file:/fake.svg";
   
    SAXSVGDocumentFactory df = new SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
    SVGDocument document = df.createSVGDocument(uri, new StringReader(xmlContent));
    if(idRegex != null && replacementColor != null)
      replaceFill(document, idRegex, replacementColor);
    return renderToImage(document, width, height, stretch);   
  }
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

  public BufferedImage renderToImage(String uri, int width, int height) throws IOException {
    return renderToImage(uri, width, height, false, null, null);
  }
 
  public BufferedImage renderToImage(String uri, int width, int height, boolean stretch, String idRegex, Color replacementColor) throws IOException {
    SAXSVGDocumentFactory df = new SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
    SVGDocument document = df.createSVGDocument(uri);
    if(idRegex != null && replacementColor != null)
      replaceFill(document, idRegex, replacementColor);
    return renderToImage(document, width, height, stretch);
  }
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

    final String file = args[0].toString();
    try
    {
      final BaseScope scope = (BaseScope) thisObj;
      final String parser = "org.apache.xerces.parsers.SAXParser";//XMLResourceDescriptor.getXMLParserClassName();
      final SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
      final String uri = "file:" + scope.basePath + "/" + file;
      final SVGOMDocument doc = (SVGOMDocument) f.createDocument(uri);

      // Initialize the CSS Engine for the document
      final SVGDOMImplementation impl = (SVGDOMImplementation) SVGDOMImplementation.getDOMImplementation();
      final UserAgent userAgent = new UserAgentAdapter();
      final BridgeContext ctx = new BridgeContext(userAgent, new DocumentLoader(userAgent));
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

             String hardtokensnprefix) throws IOException {
      this.validityms = ( ((long)validity) * 1000 3600 * 24); // Validity i ms
      this.hardtokensnprefix = hardtokensnprefix;     

      String parser = XMLResourceDescriptor.getXMLParserClassName();
      SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
      String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
      Document doc = f.createDocument(svgNS, svgdata);  

      svgdoc = ((SVGOMDocument) doc);  
   
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

                    doc = (SVGDocument)domSrc.getNode();
                } else {
                    in = new UnclosableInputStream(ImageUtil.needInputStream(src));
                    int length = in.available();
                    in.mark(length + 1);
                    SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(
                            getParserName());
                    doc = factory.createSVGDocument(src.getSystemId(), in);
                }
                ImageInfo info = createImageInfo(uri, context, doc);

                return info;
            } catch (NoClassDefFoundError ncdfe) {
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

     * Creates the <tt>TranscoderInput</tt>.
     */
    protected TranscoderInput createTranscoderInput() {
  try {
      String parser = XMLResourceDescriptor.getXMLParserClassName();
      SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
      Document doc = f.createDocument(resolveURL(inputURI).toString());
      return new TranscoderInput(doc);
  } catch (IOException ex) {
            throw new IllegalArgumentException(inputURI);
  }
    }
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

        // First step:
        //
        // Load the input SVG into a Document object
        //
        String parserClassName = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parserClassName);
        Document doc = null;

        try {
            doc = f.createDocument(svgURL);
        } catch(IOException e){
            report.setErrorCode(ERROR_CANNOT_LOAD_SVG_DOCUMENT);
            report.addDescriptionEntry(ENTRY_KEY_ERROR_DESCRIPTION,
                                       e.getMessage());
            report.setPassed(false);
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

        // First step:
        //
        // Load the input SVG into a Document object
        //
        String parserClassName = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parserClassName);
        f.setValidating(validate.booleanValue());
        Document doc = null;
       
        try {
            doc = f.createDocument(svgURL);
        } catch(Exception e){
            e.printStackTrace();
            return handleException(e);
        }
       
View Full Code Here

Examples of org.apache.batik.dom.svg.SAXSVGDocumentFactory

            assertTrue(t.passed);
        }
        // Document
        {
            String parser = XMLResourceDescriptor.getXMLParserClassName();
            SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
            Document doc = f.createDocument(TEST_URI);       
            TranscoderInput ti = new TranscoderInput(doc);
            ti.setURI(TEST_URI);
            t = new TestTranscoder();
            t.transcode(ti, out);
            assertTrue(t.passed);
        }

        // Generic Document
        {
            String parser = XMLResourceDescriptor.getXMLParserClassName();
            DOMImplementation impl =
                GenericDOMImplementation.getDOMImplementation();
            SAXDocumentFactory f = new SAXDocumentFactory(impl, parser);
            Document doc = f.createDocument(TEST_URI);
            TranscoderInput ti = new TranscoderInput(doc);
            ti.setURI(TEST_URI);
            t = new TestTranscoder();
            t.transcode(ti, out);
            assertTrue(t.passed);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.