You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by Apache Wiki <wi...@apache.org> on 2010/01/04 16:32:37 UTC

[Xmlgraphics-batik Wiki] Update of "InputStreamInitialisation" by dao.hodac

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics-batik Wiki" for change notification.

The "InputStreamInitialisation" page has been changed by dao.hodac.
http://wiki.apache.org/xmlgraphics-batik/InputStreamInitialisation

--------------------------------------------------

New page:
To capitalized this mailing list thread :[[http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200912.mbox/<27...@mail.gmail.com>|http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200912.mbox/%3c272595f40912300947w60080f76ibdc29c7a1a702602@mail.gmail.com%3e]]

{{{#!java
connect(rmiRegistryLocation);
canvas = new JSVGCanvas();
canvas.setDocument(createDoc());
}}}
with

 . {{{#!java
private Document createDoc() throws ParserConfigurationException,
                        RemoteException, SAXException, IOException {

        String xmlDocument = remoteEngine.getSvgDocument();
        ByteArrayInputStream bais = new ByteArrayInputStream(xmlDocument.getBytes());
        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);

        return f.createDocument(DOC_URI, bais);
}
}}}

Note the DOC_URI constant. It helps the user to set up the URI of the document. If the document works from itself, in a standalone mode and does not refers to other relative paths, it can be set at null.

Else, it is necessary to put an URI that points to a non existant file so that the relative URI can be resolved.

For example, an SVG document that refers to a widgets.svg file in a tag like this one:

{{{#!xml
<use x="-53.175" y="-194.283" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="widgets.svg#BarGauge" xlink:type="simple" xlink:actuate="onLoad" id="bar2" height="388.566" xlink:show="embed"/>
}}}

should be set up with an URI that points on a file of the same directory as the widgets.svg file.

It is possible to use some jar file URL to point inside a jar (so you can embed symbols svg inside your jar):
{{{jar:file:///E:/ATOLE/gate/animator/MoowClient.jar!/panel.svg}}}