Examples of SAXSVGDocumentFactory


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

    try
    {
      UserAgent userAgent = new JRUserAgent();
     
      SVGDocumentFactory documentFactory =
        new SAXSVGDocumentFactory(userAgent.getXMLParserClassName(), true);
      documentFactory.setValidating(userAgent.isXMLParserValidating());

      SVGDocument document;
      if (svgText != null)
      {
        document = documentFactory.createSVGDocument(null,
            new StringReader(svgText));
      }
      else
      {
        document = documentFactory.createSVGDocument(null,
            new ByteArrayInputStream(svgData));
      }

      BridgeContext ctx = new BridgeContext(userAgent);
      ctx.setDynamic(true);
View Full Code Here

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


   public static SVGOMDocument createDocument (Reader reader, String dummyURI)
      throws IOException
   {
      SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(PARSER_CLASSNAME);
      return (org.apache.batik.dom.svg.SVGOMDocument)factory.createDocument(dummyURI, reader);
   }
View Full Code Here

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


   public static SVGOMDocument createDocument (InputStream inputStream, String dummyURI)
      throws IOException
   {
      SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(PARSER_CLASSNAME);
      return (org.apache.batik.dom.svg.SVGOMDocument)factory.createDocument(dummyURI, inputStream);
   }
View Full Code Here

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

         * Implements {@link
         * org.apache.batik.script.Window#parseXML(String,Document)}.
         */
        public DocumentFragment parseXML(String text, Document doc) {
            // System.out.println("Text: " + text);
            SAXSVGDocumentFactory df = new SAXSVGDocumentFactory
                (XMLResourceDescriptor.getXMLParserClassName());
            String uri = ((SVGOMDocument)bridgeContext.getDocument()).
                getURLObject().toString();
            DocumentFragment result = null;
            try {
                Document d = df.createDocument(uri, new StringReader(text));
                result = doc.createDocumentFragment();
                result.appendChild(doc.importNode(d.getDocumentElement(),
                                                  true));
            } catch (Exception ex) {
                StringBuffer sb = new StringBuffer(text.length() +
                                                   FRAGMENT_PREFIX.length() +
                                                   "</svg>".length());
                sb.append(FRAGMENT_PREFIX);
                sb.append(text);
                sb.append("</svg>");
                String newText = sb.toString();
                try {
                    Document d = df.createDocument
                        (uri, new StringReader(newText));
                    for (Node n = d.getDocumentElement().getFirstChild();
                         n != null;
                         n = n.getNextSibling()) {
                        if (n.getNodeType() == n.ELEMENT_NODE) {
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){
            return handleException(e);
        }

        //
View Full Code Here

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

     * @param domImpl the DOM Implementation (not used)
     * @param parserClassname the XML parser classname
     */
    protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
            String parserClassname) {
        return new SAXSVGDocumentFactory(parserClassname);
    }
View Full Code Here

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

     * Constructs a new <tt>DocumentLoader</tt> with the specified XML parser.
     * @param userAgent the user agent to use
     */
    public DocumentLoader(UserAgent userAgent) {
        this.userAgent = userAgent;
        documentFactory = new SAXSVGDocumentFactory
            (userAgent.getXMLParserClassName(), true);
  documentFactory.setValidating(userAgent.isXMLParserValidating());
    }
View Full Code Here

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

     * @param domImpl the DOM Implementation (not used)
     * @param parserClassname the XML parser classname
     */
    protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
                                                    String parserClassname) {
        return new SAXSVGDocumentFactory(parserClassname);
    }
View Full Code Here

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

                              result);
        sw.flush();
        sw.close();

        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        SVGDocument outDoc = null;

        try {
            outDoc = f.createSVGDocument
                (uri, new StringReader(sw.toString()));
        } catch (Exception e) {
            System.err.println("======================================");
            System.err.println(sw.toString());
            System.err.println("======================================");
View Full Code Here

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

         * Implements {@link
         * org.apache.batik.script.Window#parseXML(String,Document)}.
         */
        public DocumentFragment parseXML(String text, Document doc) {
            // System.out.println("Text: " + text);
            SAXSVGDocumentFactory df = new SAXSVGDocumentFactory
                (XMLResourceDescriptor.getXMLParserClassName());
            String uri = ((SVGOMDocument)bridgeContext.getDocument()).
                getURLObject().toString();
            DocumentFragment result = null;
            try {
                Document d = df.createDocument(uri, new StringReader(text));
                result = doc.createDocumentFragment();
                result.appendChild(doc.importNode(d.getDocumentElement(),
                                                  true));
            } catch (Exception ex) {
                StringBuffer sb = new StringBuffer(text.length() +
                                                   FRAGMENT_PREFIX.length() +
                                                   "</svg>".length());
                sb.append(FRAGMENT_PREFIX);
                sb.append(text);
                sb.append("</svg>");
                String newText = sb.toString();
                try {
                    Document d = df.createDocument
                        (uri, new StringReader(newText));
                    for (Node n = d.getDocumentElement().getFirstChild();
                         n != null;
                         n = n.getNextSibling()) {
                        if (n.getNodeType() == n.ELEMENT_NODE) {
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.