xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Unknown language: text/ecmascript [Precisions inside: problem with DOMUtilities]
Date Fri, 04 Sep 2009 10:26:38 GMT
Hi Mathieu,

> 2009/9/3 <thomas.deweese@kodak.com>
>>     Can I suggest, you use the following instead: 
>> 
>>          Document document2 = (Document) 
DOMUtilities.parseXML(documentString,null, 
>>                jfc.getSelectedFile().toURI().toString(),null,null,f);
>> 
>>     This will ensure the document as a 'base URI' associated with it 
>> in case it needs to resolve relative URL's. 

Mathieu Pedrero <mathieu.pedrero@gmail.com> wrote on 09/03/2009 08:32:21 
AM:

> Thanks: This modification resolve my problem in the case of the code
> of my precedent message...
> 
> But let's wonder... If I call the DOMUtilities.parseXML method to 
> build a document from a String which has not any URI?

   Actually, in this case I don't think it matters what URL you give it as
long as it's a 'valid' URL (i.e. you can parse it). 

Can you try the following patch to see if the original code 
(w/o the URL works)?

Index: sources/org/apache/batik/script/InterpreterPool.java
===================================================================
--- sources/org/apache/batik/script/InterpreterPool.java        (revision 
810866)
+++ sources/org/apache/batik/script/InterpreterPool.java        (working 
copy)
@@ -116,12 +116,13 @@
 
         Interpreter interpreter = null;
         SVGOMDocument svgDoc = (SVGOMDocument) document;
+        URL url = null;
         try {
-            URL url = new URL(svgDoc.getDocumentURI());
-            interpreter = factory.createInterpreter(url, 
svgDoc.isSVG12(),
-                                                    imports);
+            url = new URL(svgDoc.getDocumentURI());
         } catch (MalformedURLException e) {
         }
+        interpreter = factory.createInterpreter(url, svgDoc.isSVG12(),
+                                                imports);
 
         if (interpreter == null) return null;

Mime
View raw message