xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan wood <jonathanshaww...@gmail.com>
Subject Re: create a JSVGCanvas from an inputstream
Date Sat, 02 Jan 2010 23:19:59 GMT
There may be a way to do this "auto-magically", but I don't (yet) know it.

Try the jar protocol (jar:file://nn/file.svg)  (
http://docs.sun.com/source/819-0913/author/jar.html#jarprotocol)

Override/extend the existing UserAgent.openLink() functionality.  To save a
bit of hunting on your part...The appropriate code can be found in
JSVGComponent.BridgeUserAgent() (

You'll likely receive better guidance from the others on the list though.
I'll update you if I see something better.



On Sat, Jan 2, 2010 at 5:33 PM, dao <dao.hodac@gmail.com> wrote:

> I understand, but how can I refer to that document in an other document?
> (see the xlink:href from my mail)?
>
> On Sat, Jan 2, 2010 at 11:27 PM, jonathan wood <jonathanshawwood@gmail.com
> > wrote:
>
>> Hi Dao,
>>
>>   I also included a "load from jar" in the previous examples.  The key is
>> the line:
>>
>>         InputStream templateStream =
>> MyClass.class.getResourceAsStream("template.svg");
>>
>> getResourceAsStream will allow you to load from the classpath  (including
>> your jar).
>>
>>
>> to recap:
>>
>>         InputStream templateStream =
>> MyClass.class.getResourceAsStream("template.svg");
>>
>>         String parser = XMLResourceDescriptor.getXMLParserClassName();
>>         SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
>>         SVGDocument doc = null;
>>
>>         try {
>>             doc = f.createSVGDocument(null, templateStream);
>>         } catch (IOException ex) {
>>         }
>>
>>        myCanvas.setSVGDocument(doc);
>>
>>
>>
>> On Sat, Jan 2, 2010 at 3:30 PM, dao <dao.hodac@gmail.com> wrote:
>>
>>> to continue with this inputstream document:
>>>
>>> My document that I build from an inputstream references an other document
>>> by referencing some symbols (<use xlink:href="widgets.svg#warningMask"
>>> ...)
>>>
>>> How can I do to make this work:
>>>
>>> Either I create an other document I receive from my server which is
>>> widget.svg and tell me how I can reference it (is it necessary to create a
>>> file from the stream in the file widgets.svg?)
>>>
>>> Either I have the widgets.svg file in my application's jar. In that case,
>>> How can I reference a file in a jar?
>>>
>>> Do you suggest me an other way to process?
>>>
>>>
>>> 2010/1/1 Helder Magalhães <helder.magalhaes@gmail.com>
>>>
>>> Hi dao,
>>>>
>>>>
>>>> Response inline...
>>>>
>>>>
>>>> > Added in [2]. not sure of how to reference the thread....
>>>>
>>>> Great! :-)  I noticed an entry added to the how-to, but the actual
>>>> page [1] doesn't exist yet...?
>>>>
>>>> To reference a thread, just copy a link from the archives [2]. While
>>>> using the official archives, the "trick" seems to be selecting the
>>>> desired thread or particular message and clicking on the "Message
>>>> view" link in order to get the desired thread/message hyperlink. In
>>>> this particular case, it would be [3].
>>>>
>>>> As we're at it, given than navigation/search features are not very
>>>> user friendly in the official archives IMHO, I frequently use the
>>>> Nabble archive [4], specially for searches... ;-)
>>>>
>>>>
>>>> Hope this helps,
>>>>  Helder
>>>>
>>>>
>>>> [1] http://wiki.apache.org/xmlgraphics-batik/InputStreamInitialisation
>>>> [2] http://mail-archives.apache.org/mod_mbox/
>>>> [3]
>>>> http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200912.mbox/%3C272595f40912300947w60080f76ibdc29c7a1a702602@mail.gmail.com%3E
>>>> [4] http://old.nabble.com/Batik-f308.html
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>>> For additional commands, e-mail:
>>>> batik-users-help@xmlgraphics.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Dao Hodac
>>>
>>
>>
>
>
> --
> Dao Hodac
>

Mime
View raw message