Examples of SAXSVGDocumentFactory


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

     * @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

         * org.apache.batik.script.Window#parseXML(String,Document)}.
         */
        public Node parseXML(String text, Document doc) {
            // System.err.println("Text: " + text);
            // Try and parse it as an SVGDocument
            SAXSVGDocumentFactory df = new SAXSVGDocumentFactory
                (XMLResourceDescriptor.getXMLParserClassName());
            URL urlObj = null;
            if ((doc != null) && (doc instanceof SVGOMDocument))
                urlObj = ((SVGOMDocument)doc).getURLObject();
            if (urlObj == null) {
                urlObj = ((SVGOMDocument)bridgeContext.getDocument()).
                    getURLObject();
            }
            String uri = (urlObj==null)?"":urlObj.toString();
            try {
                Document d = df.createDocument(uri, new StringReader(text));
                if (doc == null)
                    return d;

                Node result = doc.createDocumentFragment();
                result.appendChild(doc.importNode(d.getDocumentElement(),
                                                  true));
                return result;
            } catch (Exception ex) {
                /* nothing  */
            }
           
            if ((doc != null) && (doc instanceof SVGOMDocument)) {
                // Try and parse with an 'svg' element wrapper - for
                // things like '<rect ../>' - ensure that rect ends up
                // in SVG namespace - xlink namespace is declared etc...

                // Only do this when generating a doc fragment, since
                // a 'rect' element can not be root of SVG Document
                // (only an svg element can be).
                StringBuffer sb = new StringBuffer(FRAGMENT_PREFIX.length() +
                                                   text.length() +
                                                   FRAGMENT_SUFFIX.length());
                sb.append(FRAGMENT_PREFIX);
                sb.append(text);
                sb.append(FRAGMENT_SUFFIX);
                String newText = sb.toString();
                try {
                    Document d = df.createDocument
                        (uri, new StringReader(newText));
                    // No document given so make doc fragment from our
                    // new Document.
                    if (doc == null) doc = d;
                    for (Node n = d.getDocumentElement().getFirstChild();
View Full Code Here

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

       
        String docString = stringWriter.toString();
        System.err.println(">>>>>>>>>>> Document content \n\n" + docString + "\n\n<<<<<<<<<<<<<<<<");

        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        doc = f.createDocument("http://xml.apache.org/batik/foo.svg",
                               new StringReader(stringWriter.toString()));

        text = doc.getElementById("myText");
        cdata = (CDATASection)text.getFirstChild();
        if (cdata.getData().equals(unescapedContent)) {
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

     * @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

     * Possibly need a slightly different design for the image stuff.
     */
    protected boolean loadImage(String uri) {
        // parse document and get the size attributes of the svg element
        try {
            SAXSVGDocumentFactory factory =
              new SAXSVGDocumentFactory(SVGImage.getParserName());
            SVGDocument doc = factory.createDocument(uri, imageStream);

            Element e = ((SVGDocument)doc).getRootElement();
            String s;
            UserAgent userAgent = new MUserAgent(new AffineTransform());
            BridgeContext ctx = new BridgeContext(userAgent);
View Full Code Here

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

        return parserClassName;
    }

    protected void loadImage() throws FopImageException {
        try {
            SAXSVGDocumentFactory factory =
                new SAXSVGDocumentFactory(SVGImage.getParserName());
            doc = factory.createDocument(this.m_href.toExternalForm());
        } catch (Exception e) {
            MessageHandler.errorln("Could not load external SVG: "
                                   + e.getMessage());
        }
    }
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
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.