cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <reinh...@apache.org>
Subject Streaming strings in JXTemplate
Date Thu, 12 May 2005 10:42:52 GMT

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

----
<jx:set var="streamer" value="${request.getAttribute('streamer')}"/>		
<p>#{toSAX($streamer, '&lt;b&gt;blah&lt;/b&gt;', $cocoon/consumer)}"/></p>
----
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?

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------


Mime
View raw message