-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Cameron McCormack wrote:
> Hi Bogdan.
>
> Bogdan:
>> I encountered a small problem with batik-1.7: lets say I'm creating a
>> new SVGDocument, passing a new DocumentType to the constructor. I
>> can't remember the exact values, but it goes something like this:
>>
>> SVGDOMImplementation.createDocument (..., ...,
>> SVGDOMImplementation.createDocumentType ("",
>> SVGConstants.SVG_PUBLIC_ID,
>> SVGConstants.SVG_SYSTEM_ID)
>> );
>>
>> According to the docs, I'm doing everything correctly (public id goes
>> second, system id goes third).
>
> Although not related to the problem you mention, it’s not legal to pass
> an empty string as the first argument to createDocumentType(). Batik
> doesn’t throw the appropriate exception for it, at the moment. (Filed
> https://issues.apache.org/bugzilla/show_bug.cgi?id=46430 for that.)This was just an example. Now it turned out I didn't use an empty String for that parameter in working code. >> Then, I'm using a Transcoder to write >> the document to a file and it has a DOCTYPE declaration, but: >> - the system id shows up where the public id should be >> - the public id is missing >> >> To get the file's DOCTYPE right, I had to use >> >> SVGDOMImplementation.createDocumentType (SVGConstants.SVG_PUBLIC_ID, >> SVGConstants.SVG_SYSTEM_ID, ""). >> >> Am I missing something? > > Sounds like a bug in serialisation code somewhere. Could you supply a > small test case that uses the transcoder to write out SVG that > demonstrates the problem? Ah, I was afraid you would say that. I didn't have the code at home, so I had to rewrite from scratch. Anyway, see the attachments: - - BatikTest1.java - the test code, which generates 2 SVG files: - - test1.svg - incorrect SVG DOCTYPE while passing correct parameters. I don't know what to pass in qualified name, but that's not the issue. - - test2.svg - correct SVG DOCTYPE while passing incorrect parameters [...] >> P.S. What about my previous 9 patches sent on 2008-09-14? Did you get >> them? Any reply will do. > > We did, and I replied on list: > > http://markmail.org/message/5l4ahy6q5uwf7zgl That didn't reach my mailbox, hence the question. Thanks for replying. I guess I should have looked more closely at the archive. Sorry. My answers: 1) I realized that fact on interfaces (that all fields are public static final) after I sent the mail, but I like to have it always explicitly written, so when the way of thinking changes (or perhaps a different Java implementation thinks in a different way), these fields will still be reachable. 2) [about halting Batik threads] I meant an ability to close Batik by force, like when something bad happened, but we wanted to keep the rest of the program running (I personally do this after an OutOfMemoryError). The static thread field shouldn't be visible, but a static "halt"-like method would be nice. Detecting if Batik is idle shouldn't be much of a problem from the programmer's point of view, as far as I remember (installing an IdleRunnable?), but detecting class/object usage from within Batik? I don't know, I guess you're right with watching References. 3) [AndWait() methods: returning immediately if the thread is null, but should throw an exception instead] The methods throw an exception if the thread is null. I guess I meant the last line: if (getThread() != null) l.lock(); If the thread became null in the meanwhile, we don't lock the object, because it would never get released and hang the program. > None of the developers have had much time recently, so that bug for your > patches is still open. Okay, no problem. I understand this perfectly, I also not always have all the time I'd wish to have for my projects. Take your time and do the job well! - -- Pozdrawiam/Regards - Bogdan (GNU/Linux & FreeDOS) Kurs asemblera x86 (DOS, GNU/Linux):http://rudy.mif.pg.gda.pl/~bogdro Grupy dyskusyjne o asm: pl.comp.lang.asm alt.pl.asm alt.pl.asm.win32 www.JabberPL.org www.TorProject.org Soft (EN): miniurl.pl/bogdro-soft -----BEGIN PGP SIGNATURE----- iD8DBQFJT8DKNTrTaBxW2h4RA75SAJ98wNZx9TjevzyoeKkKc0FUReWZWwCfZpIb fzCQnaSDCUH2ixhjx7H9qLo= =93QS -----END PGP SIGNATURE-----
import java.io.FileOutputStream;
import java.io.PrintWriter;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
import org.apache.batik.util.SVGConstants;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;
//import org.w3c.dom.DocumentType;
public class BatikTest1
{
public static void main (String[] args)
throws java.io.FileNotFoundException,
org.apache.batik.transcoder.TranscoderException,
java.io.IOException
{
// first the "correct" DOCTYPE creation.
// results in:
// <!DOCTYPE svg PUBLIC "XXX" "-//W3C//DTD SVG 1.0//EN" >
DOMImplementation impl =
SVGDOMImplementation.getDOMImplementation ();
Document doc =
impl.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg",
impl.createDocumentType (
// qualified name
"XXX",
// public id
SVGConstants.SVG_PUBLIC_ID,
// system id
SVGConstants.SVG_SYSTEM_ID));
Transcoder t = new SVGTranscoder ();
t.addTranscodingHint (SVGTranscoder.KEY_DOCTYPE,
SVGTranscoder.VALUE_DOCTYPE_KEEP_UNCHANGED);
TranscoderInput input = new TranscoderInput (doc);
PrintWriter ostream = new PrintWriter ("test1.svg");
TranscoderOutput output = new TranscoderOutput (ostream);
t.transcode (input, output);
ostream.flush ();
ostream.close ();
// now the "incorrect" DOCTYPE creation
// results in:
// <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
//
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" >
doc = impl.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg",
impl.createDocumentType (
// qualified name should go here:
SVGConstants.SVG_PUBLIC_ID,
// public id should go here:
SVGConstants.SVG_SYSTEM_ID,
// system id should go here:
""));
input = new TranscoderInput (doc);
ostream = new PrintWriter ("test2.svg");
output = new TranscoderOutput (ostream);
t.transcode (input, output);
ostream.flush ();
ostream.close ();
System.exit (0);
}
}
<<inline: test1.svg>>
<<inline: test2.svg>>
BatikTest1.java.sig
Description: PGP signature
test1.svg.sig
Description: PGP signature
test2.svg.sig
Description: PGP signature
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
