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
--------------------------------------------------------------------




Reply via email to