You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Philippe Converset <pc...@Qarbon.com> on 2003/05/14 11:52:09 UTC

SVG doc won't render when loaded as an input stream

Hi,

I'm having trouble loading a SVG document from an InputStream. My
document is perfectly loaded and rendered inside Squiggle but it won't
render when I try to load it as an input stream in my app using
SAXSVGDocumentFactory. Here is an extract from my code and the error
stack. My SVG document contains a gradient definition and a use tag that
seems to be the reason of the failure (see the attached file).

public void loadSVG(InputStream inputStream)
{
          String parser = XMLResourceDescriptor.getXMLParserClassName();
          SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
          Document document = factory.createDocument(null, inputStream);

          svgCanvas.setSVGDocument((SVGDocument) document);
}


An I/O error occured while processing the URI '#MyGradient' specified on
the element <rect>

org.apache.batik.bridge.BridgeException: null:-1
An I/O error occured while processing the URI '#MyGradient' specified on
the element <rect>
     at
org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source)
     at org.apache.batik.bridge.PaintServer.convertURIPaint(Unknown Source)
     at org.apache.batik.bridge.PaintServer.convertPaint(Unknown Source)
     at org.apache.batik.bridge.PaintServer.convertFillPaint(Unknown Source)
     at org.apache.batik.bridge.PaintServer.convertFillAndStroke(Unknown
Source)
     at
org.apache.batik.bridge.SVGShapeElementBridge.createShapePainter(Unknown
Source)
     at
org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(Unknown
Source)
     at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
     at
org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown
Source)
     at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
     at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
     at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
     at org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source)


Any help appreciated,

Philippe.




Re: SVG doc won't render when loaded as an input stream

Posted by Philippe Converset <pc...@Qarbon.com>.
It works perfectly!

Thanks a lot,

Philippe

Thomas E Deweese a écrit:

>Can you tell me if the following patch solves the problem (also
>turning on line numbers would be useful).
>
>  Sorry I messed up in a final round of cleanup on the patch (the
>'xmlBase == null' should have been '!=').  Try this patch instead:
>
>
>
>Index: sources/org/apache/batik/bridge/CSSUtilities.java
>===================================================================
>RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
>retrieving revision 1.43
>diff -w -u -r1.43 CSSUtilities.java
>--- sources/org/apache/batik/bridge/CSSUtilities.java   13 May 2003 18:59:44 -00001.43
>+++ sources/org/apache/batik/bridge/CSSUtilities.java   14 May 2003 14:30:03 -0000
>@@ -861,12 +861,21 @@
>                                            String  uri) {
>         Attr xmlBase = localRefElement.getAttributeNodeNS
>             (XML_NAMESPACE_URI, "xml:base");
>+        ParsedURL purl = new ParsedURL(uri);
>         if (xmlBase != null) {
>             // We have a current base so merge it with our new base and
>             // set the result...
>-            ParsedURL purl = new ParsedURL(uri, xmlBase.getNodeValue());
>-            uri = purl.toString();
>+            purl = new ParsedURL(purl, xmlBase.getNodeValue());
>         }
>+
>+        // Get the URL sans fragment.
>+        uri = purl.getPortStr();
>+        String path = purl.getPath();
>+        if (path != null)
>+            uri += path;
>+
>+        if (uri.length() != 0)
>+            // Only set xml:base if we have a real URL.
>         localRefElement.setAttributeNS(XML_NAMESPACE_URI,
>                                        "xml:base",
>                                        uri);
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
>  
>



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


Re: SVG doc won't render when loaded as an input stream

Posted by Philippe Converset <pc...@Qarbon.com>.
Could you send the whole method instead of CVS differences ? This will 
be easier and safer for me to integrate.

Thanks,

Philippe

Thomas E Deweese a écrit:

>Can you tell me if the following patch solves the problem (also
>turning on line numbers would be useful).
>
>  Sorry I messed up in a final round of cleanup on the patch (the
>'xmlBase == null' should have been '!=').  Try this patch instead:
>
>
>
>Index: sources/org/apache/batik/bridge/CSSUtilities.java
>===================================================================
>RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
>retrieving revision 1.43
>diff -w -u -r1.43 CSSUtilities.java
>--- sources/org/apache/batik/bridge/CSSUtilities.java   13 May 2003 18:59:44 -00001.43
>+++ sources/org/apache/batik/bridge/CSSUtilities.java   14 May 2003 14:30:03 -0000
>@@ -861,12 +861,21 @@
>                                            String  uri) {
>         Attr xmlBase = localRefElement.getAttributeNodeNS
>             (XML_NAMESPACE_URI, "xml:base");
>+        ParsedURL purl = new ParsedURL(uri);
>         if (xmlBase != null) {
>             // We have a current base so merge it with our new base and
>             // set the result...
>-            ParsedURL purl = new ParsedURL(uri, xmlBase.getNodeValue());
>-            uri = purl.toString();
>+            purl = new ParsedURL(purl, xmlBase.getNodeValue());
>         }
>+
>+        // Get the URL sans fragment.
>+        uri = purl.getPortStr();
>+        String path = purl.getPath();
>+        if (path != null)
>+            uri += path;
>+
>+        if (uri.length() != 0)
>+            // Only set xml:base if we have a real URL.
>         localRefElement.setAttributeNS(XML_NAMESPACE_URI,
>                                        "xml:base",
>                                        uri);
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
>  
>



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


Re: SVG doc won't render when loaded as an input stream

Posted by Thomas E Deweese <th...@kodak.com>.
Can you tell me if the following patch solves the problem (also
turning on line numbers would be useful).

  Sorry I messed up in a final round of cleanup on the patch (the
'xmlBase == null' should have been '!=').  Try this patch instead:



Index: sources/org/apache/batik/bridge/CSSUtilities.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
retrieving revision 1.43
diff -w -u -r1.43 CSSUtilities.java
--- sources/org/apache/batik/bridge/CSSUtilities.java   13 May 2003 18:59:44 -00001.43
+++ sources/org/apache/batik/bridge/CSSUtilities.java   14 May 2003 14:30:03 -0000
@@ -861,12 +861,21 @@
                                            String  uri) {
         Attr xmlBase = localRefElement.getAttributeNodeNS
             (XML_NAMESPACE_URI, "xml:base");
+        ParsedURL purl = new ParsedURL(uri);
         if (xmlBase != null) {
             // We have a current base so merge it with our new base and
             // set the result...
-            ParsedURL purl = new ParsedURL(uri, xmlBase.getNodeValue());
-            uri = purl.toString();
+            purl = new ParsedURL(purl, xmlBase.getNodeValue());
         }
+
+        // Get the URL sans fragment.
+        uri = purl.getPortStr();
+        String path = purl.getPath();
+        if (path != null)
+            uri += path;
+
+        if (uri.length() != 0)
+            // Only set xml:base if we have a real URL.
         localRefElement.setAttributeNS(XML_NAMESPACE_URI,
                                        "xml:base",
                                        uri);


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


Re: SVG doc won't render when loaded as an input stream

Posted by Thomas E Deweese <th...@kodak.com>.
Can you tell me if the following patch solves the problem (also
turning on line numbers would be useful).

Index: sources/org/apache/batik/bridge/CSSUtilities.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
retrieving revision 1.43
diff -w -u -r1.43 CSSUtilities.java
--- sources/org/apache/batik/bridge/CSSUtilities.java   13 May 2003 18:59:44 -00001.43
+++ sources/org/apache/batik/bridge/CSSUtilities.java   14 May 2003 14:17:04 -0000
@@ -861,12 +861,21 @@
                                            String  uri) {
         Attr xmlBase = localRefElement.getAttributeNodeNS
             (XML_NAMESPACE_URI, "xml:base");
-        if (xmlBase != null) {
+        ParsedURL purl = new ParsedURL(uri);
+        if (xmlBase == null) {
             // We have a current base so merge it with our new base and
             // set the result...
-            ParsedURL purl = new ParsedURL(uri, xmlBase.getNodeValue());
-            uri = purl.toString();
+            purl = new ParsedURL(purl, xmlBase.getNodeValue());
         }
+
+        // Get the URL sans fragment.
+        uri = purl.getPortStr();
+        String path = purl.getPath();
+        if (path != null)
+            uri += path;
+
+        if (uri.length() != 0)
+            // Only set xml:base if we have a real URL.
         localRefElement.setAttributeNS(XML_NAMESPACE_URI,
                                        "xml:base",
                                        uri);



>>>>> "TD" == Thomas E Deweese <th...@kodak.com> writes:

>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:
PC> Here is the SVG code that fails:

TD>     So it appears that the problem is with the use/inherited
TD> gradient on a document with no base URI...  In particular
TD> bridge.CSSUtilities.computeStyleAndURIs should avoid setting
TD> xml:base in cases where the URI is only a fragment.

TD>     The issue may be deeper than this.


TD> <?xml version="1.0"
PC> encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
PC> 20010904//EN"
PC> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg
PC> width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"
PC> xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient
PC> id="MyGradient"> <stop offset="5%" stop-color="#F60" /> <stop
PC> offset="95%" stop-color="#FF6" /> </linearGradient> <rect
PC> id="MyShape" height="48" width="70"/> </defs> <use
PC> xlink:href="#MyShape" fill="url(#MyGradient)"/> </svg>

PC> Philippe

PC> Thomas E Deweese a écrit:

>>> Can you send the offending file?
>>> 
>>> 
>>> 
>>>>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:
>>>>>>>> 
>>>>>>>> 
>>>
PC> I'm using last version of Batik (1.5 beta 5).
>>>
>>>> Thomas E Deweese a écrit:
>>>> 
>>>> 
>>>
>>>>> Hi Philippe,
>>>>> 
>>>>> What version of Batik are you using?  Earlier versions had
>>>>> problems with documents that didn't have an associated document
>>>>> URL.  I think most/all of these have been resolved (certainly
>>>>> for something simple like a gradient reference).
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>
PC> ---------------------------------------------------------------------
PC> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
PC> additional commands, e-mail: batik-users-help@xml.apache.org
>>> 
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
>>> additional commands, e-mail: batik-users-help@xml.apache.org
>>> 
>>> 
>>> 
>>> 
>>> 

PC> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
PC> <html> <head> <meta http-equiv="Content-Type"
PC> content="text/html;charset=ISO-8859-1"> <title></title> </head>
PC> <body> Here is the SVG code that fails:<br> <br> &lt;?xml
PC> version="1.0" encoding="utf-8"?&gt;<br> &lt;!DOCTYPE svg PUBLIC
PC> "-//W3C//DTD SVG 20010904//EN" <a class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"</a>&gt;<br>
PC> &lt;svg width="100%" height="100%" xmlns=<a
PC> class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/2000/svg">"http://www.w3.org/2000/svg"</a>
PC> xmlns:xlink=<a class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/1999/xlink">"http://www.w3.org/1999/xlink"</a>&gt;<br>
PC> &nbsp; &lt;defs&gt;<br> &nbsp;&nbsp;&nbsp; &lt;linearGradient
PC> id="MyGradient"&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;stop
PC> offset="5%" stop-color="#F60" /&gt;<br>
PC> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;stop offset="95%"
PC> stop-color="#FF6" /&gt;<br> &nbsp;&nbsp;&nbsp;
PC> &lt;/linearGradient&gt;<br> &nbsp;&nbsp;&nbsp; &lt;rect
PC> id="MyShape" height="48" width="70"/&gt;<br> &nbsp;
PC> &lt;/defs&gt;<br> &nbsp; &lt;use xlink:href="#MyShape"
PC> fill="url(#MyGradient)"/&gt;<br> &lt;/svg&gt;<br> <br>
PC> Philippe<br> <br> Thomas E Deweese a &eacute;crit:<br> <blockquote
PC> type="cite" cite="mid16066.18120.598686.285939@frog.rl.kodak.com">
PC> <pre wrap="">Can you send the offending file?

PC> </pre> <blockquote type="cite"> <blockquote type="cite">
PC> <blockquote type="cite"> <blockquote type="cite"> <blockquote
PC> type="cite"> <pre wrap="">"PC" == Philippe Converset <a
PC> class="moz-txt-link-rfc2396E"
PC> href="mailto:pconverset@qarbon.com">&lt;pconverset@qarbon.com&gt;</a>
PC> writes: </pre> </blockquote> </blockquote> </blockquote>
PC> </blockquote> </blockquote> <pre wrap=""><!----> PC&gt; I'm using
PC> last version of Batik (1.5 beta 5).

PC> </pre> <blockquote type="cite"> <pre wrap="">Thomas E Deweese a
PC> &eacute;crit: </pre> </blockquote> <pre wrap=""><!----> </pre>
PC> <blockquote type="cite"> <blockquote type="cite"> <pre wrap="">Hi
PC> Philippe,

PC> What version of Batik are you using?  Earlier versions had
PC> problems with documents that didn't have an associated document
PC> URL.  I think most/all of these have been resolved (certainly for
PC> something simple like a gradient reference).


PC> </pre> </blockquote> </blockquote> <pre wrap=""><!---->


PC> PC&gt;
PC> ---------------------------------------------------------------------
PC> PC&gt; To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
PC> For PC&gt; additional commands, e-mail: <a
PC> class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>




PC> ---------------------------------------------------------------------
PC> To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
PC> For additional commands, e-mail: <a
PC> class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>



PC> </pre> </blockquote> <br> </body> </html>


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




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


Re: SVG doc won't render when loaded as an input stream

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:

PC> Here is the SVG code that fails: 

    So it appears that the problem is with the use/inherited gradient
on a document with no base URI...  In particular
bridge.CSSUtilities.computeStyleAndURIs should avoid setting xml:base
in cases where the URI is only a fragment.

    The issue may be deeper than this.


<?xml version="1.0"
PC> encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
PC> 20010904//EN"
PC> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg
PC> width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"
PC> xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient
PC> id="MyGradient"> <stop offset="5%" stop-color="#F60" /> <stop
PC> offset="95%" stop-color="#FF6" /> </linearGradient> <rect
PC> id="MyShape" height="48" width="70"/> </defs> <use
PC> xlink:href="#MyShape" fill="url(#MyGradient)"/> </svg>

PC> Philippe

PC> Thomas E Deweese a écrit:

>> Can you send the offending file?
>> 
>> 
>> 
>>>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:
>>>>>>> 
>>>>>>> 
>>
PC> I'm using last version of Batik (1.5 beta 5).
>>
>>> Thomas E Deweese a écrit:
>>> 
>>> 
>>
>>>> Hi Philippe,
>>>> 
>>>> What version of Batik are you using?  Earlier versions had
>>>> problems with documents that didn't have an associated document
>>>> URL.  I think most/all of these have been resolved (certainly for
>>>> something simple like a gradient reference).
>>>> 
>>>> 
>>>> 
>>>> 
>>
PC> ---------------------------------------------------------------------
PC> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
PC> additional commands, e-mail: batik-users-help@xml.apache.org
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
>> additional commands, e-mail: batik-users-help@xml.apache.org
>> 
>> 
>> 
>> 
>> 

PC> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
PC> <html> <head> <meta http-equiv="Content-Type"
PC> content="text/html;charset=ISO-8859-1"> <title></title> </head>
PC> <body> Here is the SVG code that fails:<br> <br> &lt;?xml
PC> version="1.0" encoding="utf-8"?&gt;<br> &lt;!DOCTYPE svg PUBLIC
PC> "-//W3C//DTD SVG 20010904//EN" <a class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"</a>&gt;<br>
PC> &lt;svg width="100%" height="100%" xmlns=<a
PC> class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/2000/svg">"http://www.w3.org/2000/svg"</a>
PC> xmlns:xlink=<a class="moz-txt-link-rfc2396E"
PC> href="http://www.w3.org/1999/xlink">"http://www.w3.org/1999/xlink"</a>&gt;<br>
PC> &nbsp; &lt;defs&gt;<br> &nbsp;&nbsp;&nbsp; &lt;linearGradient
PC> id="MyGradient"&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;stop
PC> offset="5%" stop-color="#F60" /&gt;<br>
PC> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;stop offset="95%"
PC> stop-color="#FF6" /&gt;<br> &nbsp;&nbsp;&nbsp;
PC> &lt;/linearGradient&gt;<br> &nbsp;&nbsp;&nbsp; &lt;rect
PC> id="MyShape" height="48" width="70"/&gt;<br> &nbsp;
PC> &lt;/defs&gt;<br> &nbsp; &lt;use xlink:href="#MyShape"
PC> fill="url(#MyGradient)"/&gt;<br> &lt;/svg&gt;<br> <br>
PC> Philippe<br> <br> Thomas E Deweese a &eacute;crit:<br> <blockquote
PC> type="cite" cite="mid16066.18120.598686.285939@frog.rl.kodak.com">
PC> <pre wrap="">Can you send the offending file?

PC>   </pre> <blockquote type="cite"> <blockquote type="cite">
PC> <blockquote type="cite"> <blockquote type="cite"> <blockquote
PC> type="cite"> <pre wrap="">"PC" == Philippe Converset <a
PC> class="moz-txt-link-rfc2396E"
PC> href="mailto:pconverset@qarbon.com">&lt;pconverset@qarbon.com&gt;</a>
PC> writes: </pre> </blockquote> </blockquote> </blockquote>
PC> </blockquote> </blockquote> <pre wrap=""><!----> PC&gt; I'm using
PC> last version of Batik (1.5 beta 5).

PC>   </pre> <blockquote type="cite"> <pre wrap="">Thomas E Deweese a
PC> &eacute;crit: </pre> </blockquote> <pre wrap=""><!----> </pre>
PC> <blockquote type="cite"> <blockquote type="cite"> <pre wrap="">Hi
PC> Philippe,

PC> What version of Batik are you using?  Earlier versions had
PC> problems with documents that didn't have an associated document
PC> URL.  I think most/all of these have been resolved (certainly for
PC> something simple like a gradient reference).


PC>       </pre> </blockquote> </blockquote> <pre wrap=""><!---->


PC> PC&gt;
PC> ---------------------------------------------------------------------
PC> PC&gt; To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
PC> For PC&gt; additional commands, e-mail: <a
PC> class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>




PC> ---------------------------------------------------------------------
PC> To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
PC> For additional commands, e-mail: <a
PC> class="moz-txt-link-abbreviated"
PC> href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>



PC>   </pre> </blockquote> <br> </body> </html>


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


Re: SVG doc won't render when loaded as an input stream

Posted by Philippe Converset <pc...@Qarbon.com>.
Here is the SVG code that fails:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <linearGradient id="MyGradient">
      <stop offset="5%" stop-color="#F60" />
      <stop offset="95%" stop-color="#FF6" />
    </linearGradient>
    <rect id="MyShape" height="48" width="70"/>
  </defs>
  <use xlink:href="#MyShape" fill="url(#MyGradient)"/>
</svg>

Philippe

Thomas E Deweese a écrit:

>Can you send the offending file?
>
>  
>
>>>>>>"PC" == Philippe Converset <pc...@qarbon.com> writes:
>>>>>>            
>>>>>>
>
>PC> I'm using last version of Batik (1.5 beta 5).  
>
>  
>
>>Thomas E Deweese a écrit:
>>    
>>
>
>  
>
>>>Hi Philippe,
>>>
>>>What version of Batik are you using?  Earlier versions had problems
>>>with documents that didn't have an associated document URL.  I
>>>think most/all of these have been resolved (certainly for something
>>>simple like a gradient reference).
>>>
>>>
>>>      
>>>
>
>
>
>PC> ---------------------------------------------------------------------
>PC> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
>PC> additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
>  
>


Re: SVG doc won't render when loaded as an input stream

Posted by Thomas E Deweese <th...@kodak.com>.
Can you send the offending file?

>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:

PC> I'm using last version of Batik (1.5 beta 5).  

> Thomas E Deweese a écrit:

>> Hi Philippe,
>> 
>> What version of Batik are you using?  Earlier versions had problems
>> with documents that didn't have an associated document URL.  I
>> think most/all of these have been resolved (certainly for something
>> simple like a gradient reference).
>> 
>> 



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




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


Re: SVG doc won't render when loaded as an input stream

Posted by Philippe Converset <pc...@Qarbon.com>.
I'm using last version of Batik (1.5 beta 5).

Thomas E Deweese a écrit:

>Hi Philippe,
>
>    What version of Batik are you using?  Earlier versions had
>problems with documents that didn't have an associated document URL.
>I think most/all of these have been resolved (certainly for something
>simple like a gradient reference).
>  
>



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


RE: SVG doc won't render when loaded as an input stream

Posted by Thomas E Deweese <th...@kodak.com>.
Hi Philippe,

    What version of Batik are you using?  Earlier versions had
problems with documents that didn't have an associated document URL.
I think most/all of these have been resolved (certainly for something
simple like a gradient reference).

>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:

PC> I'm having trouble loading a SVG document from an InputStream. My
PC> document is perfectly loaded and rendered inside Squiggle but it
PC> won't render when I try to load it as an input stream in my app
PC> using SAXSVGDocumentFactory. 


PC> Here is an extract from my code and the error stack. My SVG
PC> document contains a gradient definition and a use tag that seems
PC> to be the reason of the failure (see the attached file).

PC> public void loadSVG(InputStream inputStream) { String parser =
PC> XMLResourceDescriptor.getXMLParserClassName();
PC> SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
PC> Document document = factory.createDocument(null, inputStream);

PC>           svgCanvas.setSVGDocument((SVGDocument) document); }


PC> An I/O error occured while processing the URI '#MyGradient'
PC> specified on the element <rect>

PC> org.apache.batik.bridge.BridgeException: null:-1 An I/O error
PC> occured while processing the URI '#MyGradient' specified on the
PC> element <rect> at
PC> org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown
PC> Source) at
PC> org.apache.batik.bridge.PaintServer.convertURIPaint(Unknown
PC> Source) at
PC> org.apache.batik.bridge.PaintServer.convertPaint(Unknown Source)
PC> at org.apache.batik.bridge.PaintServer.convertFillPaint(Unknown
PC> Source) at
PC> org.apache.batik.bridge.PaintServer.convertFillAndStroke(Unknown
PC> Source) at
PC> org.apache.batik.bridge.SVGShapeElementBridge.createShapePainter(Unknown
PC> Source) at
PC> org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(Unknown
PC> Source) at org.apache.batik.bridge.GVTBuilder.build(Unknown
PC> Source) at
PC> org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown
PC> Source) at
PC> org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown
PC> Source) at
PC> org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
PC> at org.apache.batik.bridge.GVTBuilder.build(Unknown Source) at
PC> org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source)


PC> Any help appreciated,

PC> Philippe.



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


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