I've had to do this before and found the Transcoder API to be most helpful:
 
final SVGDocument svgDocument = ...;
final StringWriter writer = new StringWriter();
final TranscoderInput input = new TranscoderInput(svgDocument);
final TranscoderOutput output = new TranscoderOutput(stringWriter);
final Transcoder transcoder = new SVGTranscoder();
 
transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE, 
SVGTranscoder.VALUE_DOCTYPE_REMOVE);
transcoder.transcode(input, output);
 
final String docAsString = writer.toString();
 
Same reason too; I was using systems that weren't connected to the Internet and 
needed to load documents without resolving the DOCTYPE header.
 
Michael Bishop

________________________________

From: ninitha [mailto:[email protected]]
Sent: Mon 8/31/2009 7:13 AM
To: [email protected]
Subject: Re: Removing DOCTYPE in the SVG XML




Hi Thomas,

    Thanks for your reply..Can you please let me know how to output the fle
using
batik.dom.util.DOMUtilities.writeDocument. It will be very helpful if you do
so.

Thanks once again.

thomas.deweese wrote:
>
> Hi Ninitha,
>
> ninitha <[email protected]> wrote on 08/31/2009 05:26:33 AM:
>
>>         I am converting jFreeCharts to SVG. When I load in one of the
> XSL FO
>> Processor(Render X XEP), it throws time out error at the line <!DOCTYPE
> svg
>> PUBLIC '-//W3C//DTD SVG 1.0//EN'
>>           'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
>> If the line is removed, the XSL FO is processed and converted to PDF. So
> is
>> there a way to remove the line in the resulting SVG XML before saving
> the
>> file.Following is the code used to get the SVG file.
>
>    This should really be fixed in your XSL FO Processor, it's trying to
> read that doctype and presumably you aren't directly connected to the
> internet.  There are generally ways to configure XML parsers to either
> skip the Doctype or redirect certain known doctypes (like SVG) to a
> local instance of the doctype.
>
>>        // Write svg file
>>         OutputStream outputStream = new FileOutputStream(svgFileName);  
>
>>         Writer out = new OutputStreamWriter(outputStream, "UTF-8");
>>         g2.stream(out, true);
>
>    The SVGGraphics2D automatically emits the default SVG doctype.  You
> can bypass the Graphics2D stream method and write the SVG Document using
> some other XML serializer.  One possible replacement would be
> batik.dom.util.DOMUtilities.writeDocument.
>
>
>

--
View this message in context: 
http://www.nabble.com/Removing-DOCTYPE-in-the-SVG-XML-tp25220586p25221829.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to