Hi,
We use stream function of SVGGraphics2D to convert into Stream but if we
use SVGDOMImplementation how do we stream it in to text?
DOMImplementation impl =
SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Document doc = impl.createDocument(svgNS, "svg", null);
Element svgRoot = doc.getDocumentElement();
// set the width and height attribute on the root svg element
svgRoot.setAttributeNS(null, "width", "400");
svgRoot.setAttributeNS(null, "height", "450");
// create the rectangle
Element rectangle = doc.createElementNS(svgNS, "rect");
rectangle.setAttributeNS(null, "x", "10");
rectangle.setAttributeNS(null, "y", "20");
rectangle.setAttributeNS(null, "width", "100");
rectangle.setAttributeNS(null, "height", "50");
rectangle.setAttributeNS(null, "style", "fill:red");
// attach the rectangle to the svg root element
svgRoot.appendChild(rectangle);
SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
Writer out = new StringWriter();
svgGenerator.stream(svgGenerator.getRoot(),out);
This does not convert the document into readable xml data.
Is there any alternative?
Thanks
--
View this message in context:
http://www.nabble.com/How-to-stream-Document-object-%28Dom%29-into-String-tf2924369.html#a8174297
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]