Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 62947 invoked from network); 12 May 2005 11:12:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2005 11:12:22 -0000 Received: (qmail 82181 invoked by uid 500); 12 May 2005 11:16:16 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 81971 invoked by uid 500); 12 May 2005 11:16:14 -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 81955 invoked by uid 99); 12 May 2005 11:16:14 -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 essemtepe.nada.kth.se (HELO smtp.nada.kth.se) (130.237.222.115) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 12 May 2005 04:16:14 -0700 X-Authentication-Info: The sender was authenticated as danielf using PLAIN at smtp.nada.kth.se Received: from [83.226.251.196] (localhost [127.0.0.1]) (authenticated bits=0) by smtp.nada.kth.se (8.12.10/8.12.11) with ESMTP id j4CBCBon005863; Thu, 12 May 2005 13:12:12 +0200 (MEST) Message-ID: <42833A7B.40400@nada.kth.se> Date: Thu, 12 May 2005 13:14:03 +0200 From: Daniel Fagerstrom 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> In-Reply-To: <4283332C.2040208@apache.org> 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 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 > > ---- > >

#{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. /Daniel