- From: Florent Georges <fgeorges@fgeorges.org>
- Date: Wed, 22 Jul 2009 12:32:22 +0200
- To: "David A. Lee" <dlee@calldei.com>
- Cc: XProc Dev <xproc-dev@w3.org>
2009/7/22 Florent Georges wrote: > So WritableDocument encapsulates the Saxon serializer and its > option settings. But the only way, if I am right, to set the > actual destination is by giving a URI. Why not allowing a File, > an OutputStream or a Writer, as in an s9api's Serializer. FYI, I use a modified version of WritableDocument in which I changed the ctor from: public WritableDocument(XProcRuntime xproc, String uri, Serialization serial) { this.runtime = xproc; this.uri = uri; if (serial == null) { this.serial = new Serialization(xproc, null); this.serial.setIndent(xproc.getDebug()); // indent stdio by default when debugging } else { this.serial = serial; } } to: private WritableDocument(XProcRuntime xproc, Serialization s) { runtime = xproc; serial = s == null ? new Serialization(xproc, null) : s; serializer = new Serializer(); } public WritableDocument(XProcRuntime xproc, File out, Serialization s) { this(xproc, s); serializer.setOutputFile(out); } public WritableDocument(XProcRuntime xproc, OutputStream out, Serialization s) { this(xproc, s); serializer.setOutputStream(out); } public WritableDocument(XProcRuntime xproc, Writer out, Serialization s) { this(xproc, s); serializer.setOutputWriter(out); } along a few other changes: I do not instantiate the Serializer in write() anymore, I don't set its output stream in write() neither. I don't feel comfortable to use a modified version of a Calabash class, but this way I can benefit from Calabash serialization options as well as using s9api services... Regards, -- Florent Georges http://www.fgeorges.org/
Received on Wednesday, 22 July 2009 10:33:03 UTC