W3C home > Mailing lists > Public > xproc-dev@w3.org > July 2009

Re: Calabash: Java API

From: Florent Georges <fgeorges@fgeorges.org>
Date: Wed, 22 Jul 2009 11:11:04 +0200
Message-ID: <ebaca5bf0907220211r6499f630w82cf7f1751cf29c3@mail.gmail.com>
To: "David A. Lee" <dlee@calldei.com>
Cc: XProc Dev <xproc-dev@w3.org>
2009/7/21 David A. Lee wrote:

> The core calabash code uses Saxon S9 TinyTree documents for in
> and out which you can create using about any kind of standard
> input including JAXP using the Saxon S9 API.

  Yes, we can get the result as XDM with ReadablePipe.read(), and
that's what Calabash does in its main driver.  WritableDocument
is used, if I am correct, as a bridge between Calabash and Saxon
by configuring the Saxon Serializer with the serialization
options from Calabash:

    // the serialization options for the 'result' port
    Serialization serial = pipeline.getSerialization("result");

    // the destination URI and the writable document helper
    String uri = "...";
    WritableDocument wd = new WritableDocument(runtime, uri, serial);

    // the 'result' port
    ReadablePipe rpipe = pipeline.readFrom("result");

    // looping over its documents
    while ( rpipe.moreDocuments() ) {
        XdmNode result = rpipe.read();
        wd.write(result);
    }

  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.

  Besides a String standing for a URI seems quite fragile
regarding a File object, while it will always use the file
scheme...

  At least, that's how I understand the code after a first look.
The conclusion I came to is to duplicate most of the code of
WritableDocument.write(), which translates the serialization
options from Calabash to Saxon, in order to be able to use
directly a Saxon's Serializer...

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/
Received on Wednesday, 22 July 2009 09:11:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 22 July 2009 09:11:44 GMT