[jdom-interest] JDOM to XSLT

John L. Webber - intraWeb IT GmbH John.Webber at intraweb.de
Fri Aug 25 01:16:05 PDT 2000


This works well in a program I'm developing (nothing to do with XSLT,
but addresses the pipes issue).

-- code snippet --

final StringBuffer buffer = new StringBuffer();
XMLOutputter xmlOut = new XMLOutputter("  ", true);
PipedOutputStream pipedOut = new PipedOutputStream();
PipedInputStream pipedIn = new PipedInputStream(pipedOut);
			
final BufferedReader reader = new BufferedReader(new
InputStreamReader(pipedIn));
System.out.println(doc);
Runnable readerThread = new Runnable() {
    public void run() {
        String temp;
        try
        {
            while ( (temp = reader.readLine()) != null)
            {
                buffer.append(temp).append("\n");
            }
        }
        catch (IOException io) { io.printStackTrace();}
    }
};

Thread t = new Thread(readerThread);
t.start();
xmlOut.output(doc, pipedOut);




Lorenzo Gonzalez wrote:
> 
> > > How do I pass the JDOM document to the XSLT processor ? >I tried using
> >Piped streams but im probably doing something wrong ...snip...
> 
> >Check the FAQ - it's in there.
> >
> >-Brett
> 
> But really it's not.  It's mentioned, and the suggestion is the same as what
> Itai tried already, as far as I can tell.  However, the FAQ does mention
> that the CVS tree will soon include an example.  I'm on vacation, and I'm
> lucky to have any email at all.  My understanding of piped streams is that
> they shouldn't be used within the same thread due to possible deadlock...
> Can anyone confirm there's an example in the source tree already? Or post a
> working code snippet?
> 
> Thanks!
> Lorenzo

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
intraWeb Information Technologies GmbH
John L. Webber, Software Development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Peter-Henlein-Strasse 28-30, 85540 Haar/Munich, Germany
Tel.:  +49 89 462 385 0     (switchboard)
Tel.:  +49 89 462 385 38    (direct)
Fax:   +49 89 462 385 29
mailto:John.Webber at intraWeb.de
http://www.intraWeb.de
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the jdom-interest mailing list