thomas.deweese wrote:
>
>
> One other thing that occurs to me, are you
> calling canvas.SVGDocument with the document returned
> from the loadMap method? Or are you setting the
> URL to the same 'fileName' that you pass to the loadMap
> method?
>
>
sir, i did not understand this question..
i changed my code. i load the svg file as text then pass it to an applet.
protected String loadFile(String fileName) throws FileNotFoundException,
IOException {
String tile = "";
BufferedReader inputStream = null;
try {
String mapsFolder =
getServletContext().getRealPath("/WEB-INF/maps");
inputStream = new BufferedReader(new FileReader(mapsFolder + "/"
+ fileName));
String line;
while ((line = inputStream.readLine()) != null) {
tile = tile + line + "\n";
}
} finally {
if (inputStream != null) {
inputStream.close();
}
}
return tile;
}
the applet receives the string and converts it to svg using this function
protected SVGDocument stringToSVG(String DOMString){
SAXSVGDocumentFactory f;
Document doc = null;
StringReader sr;
try {
String parser = XMLResourceDescriptor.getXMLParserClassName();
f = new SAXSVGDocumentFactory(parser);
sr = new StringReader(DOMString);
doc = f.createDocument(null, sr);
} catch (java.io.IOException ex) {
ex.printStackTrace();
}
return (SVGDocument)doc;
}
then i apply this code in the returned SVGDocument
ProcessingInstruction pi =
doc.createProcessingInstruction("xml-stylesheet", "type=\"text/css\"
href=\"" + styleSheetURL + "\"");
doc.insertBefore(pi, doc.getDocumentElement());
and just to be sure, if i want to use the class, i will only set the class
attribute right? like element.setAttribute("class", "cssClass")
--
View this message in context:
http://www.nabble.com/how-to-load-an-external-stylesheet--tf4300368.html#a12614023
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]