private static SAXSVGDocumentFactory createFactory() { return new SAXSVGDocumentFactory( PARSER ); }
/** * Load SVG from file. */ public static SvgImage loadSvgImage( InputStream in ) throws Exception { Document document = getSvgFactory().createDocument( null, in ); return new SvgImage( document ); }
protected RenderableSVG toRenderableSVG(String svgfile, URL svgUrl) throws SAXException, IOException { RenderableSVG svg; String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); String svgUri = svgfile; // Remove parameters from file URLs, as it is not supported by Windows if ("file".equals(svgUrl.getProtocol()) && svgUrl.getQuery() != null) { int idx = svgfile.indexOf('?'); if (idx > -1) { svgUri = svgfile.substring(0, idx); } } Document doc = f.createDocument(svgUri); Map<String, String> parameters = getParametersFromUrl(svgfile); if (!parameters.isEmpty() || hasParameters(doc.getDocumentElement())) { replaceParameters(doc.getDocumentElement(), parameters); } svg = new RenderableSVG(doc); return svg; }
public SVGImageProcessor(InputStream svg, boolean mapById) { try { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); factory.setValidating(false); Document svgDocument = factory.createDocument("http://jbpm.org", svg); svgProcessor = new SVGProcessorFactory().create(svgDocument, mapById); svgProcessor.processNodes(svgDocument.getChildNodes()); } catch (IOException e) { throw new RuntimeException("Could not parse svg", e); } }
private ParsedSVG(InputStream inputStream) throws IOException { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); svgDocument = f.createSVGDocument("file://svg", inputStream); Element svgDocumentNode = svgDocument.getDocumentElement(); size = Size.createRect( parseDimension(svgDocumentNode.getAttribute("width")), parseDimension(svgDocumentNode.getAttribute("height"))); }
if (svg == null) { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); Document doc; int queryIdx = svgfile.indexOf("?"); if (svgfile.startsWith("file:/") && queryIdx > 0) { String localPath = svgfile.substring(0, queryIdx); doc = f.createDocument(localPath); } else { doc = f.createDocument(svgfile);
private Document readSVG(String svgContent) throws IOException { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); factory.setValidating(false); Document svgDocument = factory.createDocument("http://jbpm.org", new StringReader(svgContent)); return svgDocument; } }
int length = in.available(); in.mark(length + 1); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory( getParserName()); doc = factory.createSVGDocument(src.getSystemId(), in);
public static SVGDocument newDocumentFromInputStream(InputStream in) { SVGDocument ret = null; try { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); ret = (SVGDocument) factory.createDocument("",in); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ret; }
private Document readSVG(String svgContent) throws IOException { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); factory.setValidating(false); Document svgDocument = factory.createDocument("http://jbpm.org", new StringReader(svgContent)); return svgDocument; } }
/** * Creates a SVG Document instance. * @param uri The document URI. * @param inp The document input stream. * @exception IOException if an error occured while reading the document. */ public SVGDocument createSVGDocument(String uri, InputStream inp) throws IOException { return (SVGDocument)createDocument(uri, inp); }
/** * Creates a <code>DocumentFactory</code> that is used to create an SVG DOM * tree. The specified DOM Implementation is ignored and the Batik * SVG DOM Implementation is automatically used. * * @param domImpl the DOM Implementation (not used) * @param parserClassname the XML parser classname */ protected DocumentFactory createDocumentFactory(DOMImplementation domImpl, String parserClassname) { return new SAXSVGDocumentFactory(parserClassname); }
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) {
private Document createDocument() throws IOException { return new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName()).createDocument(null, this.input); }
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parserClassName); f.setValidating(validate); Document doc = null; doc = f.createDocument(svgURL); } catch(Exception e){ e.printStackTrace();
/** * Creates a SVG Document instance. * @param uri The document URI. * @param r The document reader. * @exception IOException if an error occured while reading the document. */ public SVGDocument createSVGDocument(String uri, Reader r) throws IOException { return (SVGDocument)createDocument(uri, r); }
/** * Creates a <code>DocumentFactory</code> that is used to create an SVG DOM * tree. The specified DOM Implementation is ignored and the Batik * SVG DOM Implementation is automatically used. * * @param domImpl the DOM Implementation (not used) * @param parserClassname the XML parser classname */ protected DocumentFactory createDocumentFactory(DOMImplementation domImpl, String parserClassname) { return new SAXSVGDocumentFactory(parserClassname); }
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) {
private SVGDocument getSVGDocument(QualifiedSVGResource svg) throws IOException { String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); return (SVGDocument) f.createDocument(svg.toURI().toURL().toString()); }
/** * Creates a SVG Document instance. * @param uri The document URI. * @param r The document reader. * @exception IOException if an error occured while reading the document. */ public SVGDocument createSVGDocument(String uri, Reader r) throws IOException { return (SVGDocument)createDocument(uri, r); }