logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by Graeme Gilbertson on Tue 20 Aug 2002 in response to Painting with SVG, a primer

Servlets

Sorry Jake,


I went off on a rant....


I am trying to display the data I return as a chart.


However when I view the output in a browser all I get is XML code.


I start off the output in the servlet with


res.setContentType("text/xml");
PrintWriter out = res.getWriter();


and then I call the code to draw the output (as I said in the last post, I am
merely trying to output the example from this site as a starting point)


out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.println("<svg width=\"300\" height=\"300\">");
out.println("<g id=\"db-symbol\" style=\"stroke:#000000\">");
out.println("<rect x=\"20\" y=\"130\" width=\"140\" height=\"140\"
fill=\"#41B8D4\"/>");
out.println("<circle cx=\"200\" cy=\"200\" r=\"70\" fill=\"#FFFF5C\"/>");
out.println("<path d=\"M 150,60 L 60,180 L 240,180 Z\" fill=\"#F555A8\"/>");
out.println("</g>");
out.println("</svg>");


As I say, all I get is the xml type output....so I am not sure where I am going
wrong.


Thank for your quick reply.


Graeme