Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 68827 invoked from network); 12 May 2005 11:32:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2005 11:32:36 -0000 Received: (qmail 27245 invoked by uid 500); 12 May 2005 11:36:14 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 27155 invoked by uid 500); 12 May 2005 11:36:13 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 27039 invoked by uid 99); 12 May 2005 11:36:10 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from v07274.home.net.pl (HELO v07274.home.net.pl) (212.85.125.162) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 12 May 2005 04:36:10 -0700 Received: from sj162.internetdsl.tpnet.pl (HELO ?192.168.1.62?) (lgawron.mobilebox@home@80.55.87.162) by matrix15.home.net.pl with SMTP; Thu, 12 May 2005 11:32:06 -0000 Message-ID: <42833EB9.8020005@mobilebox.pl> Date: Thu, 12 May 2005 13:32:09 +0200 From: Leszek Gawron User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Streaming strings in JXTemplate References: <4283332C.2040208@apache.org> <42833A7B.40400@nada.kth.se> In-Reply-To: <42833A7B.40400@nada.kth.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Daniel Fagerstrom wrote: > Reinhard Poetz wrote: > >> >> Can it be that difficult to stream a string as SAX events in >> JXTemplate, or did I overlook a simpler solution? >> >> - implement your own streamer object with a toSAX method >> - pass a streamer object to JXTemplate >> - assign this object to a variable >> - call the toSAX method and pass the content handler and the >> string that should be streamed to it >> >> ---- >> > value="${request.getAttribute('streamer')}"/> >>

#{toSAX($streamer, '<b>blah</b>', >> $cocoon/consumer)}"/>

>> ---- >> the toSAX method of the streamer >> public void toSAX(String content, ContentHandler handler) throws >> SAXException { >> (new StringXMLizable(content)).toSAX(new IncludeXMLConsumer(handler)); >> } >> ---- >> >> Can't we do this better? > > > From a quick check of the code it seem like jx:out is XMLizable aware, > so you should be able to use jx:out on your XMLizable object. If it > doesn't work, it is a bug that we should fix. > > If you want to make it even simpler we could either have another > instruction that parses strings to SAX, or have some attribute on jx:out > for parsing the argument. ? Almost one liner.. some users also asked about it long time ago. -- Leszek Gawron lgawron@mobilebox.pl IT Manager MobileBox sp. z o.o. +48 (61) 855 06 67 http://www.mobilebox.pl mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65