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 Bastien DEBLAIS <bd...@iftechnologies.net> on 2005/07/25 11:20:42 UTC
JavaScript to Java
Hi,
I write this in JavaScript:
fileName = 'toto.svg';
getURL(fileName, fileLoaded);
function fileLoaded(data)
{
var string = '';
if(data.success)
{
string = data.content;
}
else
{
alert('error');
return;
}
var node = parseXML(string,document);
document.getElementById('map').appendChild(node);
}
How to write the same thing in JSP.
Thanks to reply,
Best regards.
Re: JavaScript to Java
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Bastien,
Bastien DEBLAIS wrote:
> fileName = 'toto.svg';
> getURL(fileName, fileLoaded);
Use java.net.URL to get an InputStream.
> var node = parseXML(string,document);
Use org.apache.batik.dom.svg.SVGSAXDocumentFactory
to parse the XML document into a DOM Document (newDoc).
> document.getElementById('map').appendChild(node);
Use org.w3c.dom.Document.importNode, to import what
ever part is of interest of newDoc into document. Then
append the imported node as above.
If fileName is a document fragment you will need to
wrap it in an 'svg' element so it will parse.
See the code in batik.bridge.ScriptingEnvironment.Window.parseXML
to see exactly how this is done in Batik.
> How to write the same thing in JSP.
I would do all of this before I did anything with 'document'
with Batik.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org