Hi Daniel.
Daniel Siino:
> DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
>
> String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
>
> Document document = domImpl.createDocument(svgNS, "svg", null);
>
> String strPI = ("type=\"text/css\" href=\"css/svgstyle.css\" ");
>
> ProcessingInstruction pi =
> document.createProcessingInstruction("xml-stylesheet", strPI);
>
> document.insertBefore(pi, document.getDocumentElement() );
...
> The content is generated using
>
> svggen.stream(svgOutput, true); but I also tried passing the root
>
> svggen.stream(root, svgOutput, true);
It seems that the SVG generator doesn't actually output any processing
instructions it comes across. You could add this support pretty easily
by modifying org/apache/batik/svggen/XmlWriter.java to add a method to
write the PIs:
private static void writeXml(ProcessingInstruction pi, IndentWriter out)
throws IOException, SVGGraphics2DIOException {
out.write("<?");
out.write(pi.getTarget());
String data = pi.getData();
if (data.length() > 0) {
out.write(" ");
out.write(data);
}
out.write("?>");
out.write(EOL);
}
and add a case to the switch statement in writeXml(Node, Writer):
case Node.PROCESSING_INSTRUCTION:
writeXml((ProcessingInstruction)node, out);
break;
and add an import line at the top:
import org.w3c.dom.ProcessingInstruction;
Cameron
--
Cameron McCormack
| Web: http://mcc.id.au/
| ICQ: 26955922
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]