xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Ellis <dale.el...@bt.com>
Subject Re: Unknown language: text/ecmascript
Date Thu, 05 Nov 2009 18:23:31 GMT

Thanks for help Thomas,

I have narrowed it down to this in the Interpreter Pool and its because
svgDoc.getDocumentURI() is blank...

    public Interpreter createInterpreter(Document document, String language)
{
        InterpreterFactory factory =
(InterpreterFactory)factories.get(language);
        if (factory == null) return null;

        Interpreter interpreter = null;
        SVGOMDocument svgDoc = (SVGOMDocument) document;
        try {
            URL url = new URL(svgDoc.getDocumentURI());
            interpreter = factory.createInterpreter(url, svgDoc.isSVG12());
        } catch (MalformedURLException e) {
        }

        if (interpreter == null) return null;

        if (document != null)
            interpreter.bindObject(BIND_NAME_DOCUMENT, document);

        return interpreter;
    }


So why this needed?

If I go back to my code...

        try {
            // Parse the barChart.svg file into a Document.
            String parser = XMLResourceDescriptor.getXMLParserClassName();
            SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
                        
            GanttSVGXMLHandler gantthandler = new
GanttSVGXMLHandler("5YKPG", "HE3");
            //Reader reader = new StringReader(gantthandler.returnXML());
            Reader reader = new StringReader("<?xml version=\"1.0\"
standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"
\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg
width='100%' height='100%'><rect x='20' y='20' width='300' height='100'
style='fill:#DD3000;' onclick='alert(123456789);' /></svg>");
            
            doc = f.createDocument("", reader);

            svg = doc.getDocumentElement();

            // Make the text look nice.
            svg.setAttributeNS(null, "text-rendering",
"geometricPrecision");
        } catch (Exception ex) {
        }


I assumed thats picked up from        doc = f.createDocument("", reader);
and it as as if I enter somehting in there, when stepping the code in debug
svgDoc.getDocumentURI() has the calue I enter.

What am I supposed to set the URI to when the SVG document is not a physical
document on the file system??
-- 
View this message in context: http://old.nabble.com/Unknown-language%3A-text-ecmascript-tp25962063p26216668.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message