You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/09/10 13:24:02 UTC

DO NOT REPLY [Bug 23061] New: - BetwixtTransformer (analog to CastorTransformer)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23061>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23061

BetwixtTransformer (analog to CastorTransformer)

           Summary: BetwixtTransformer (analog to CastorTransformer)
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: Other
               URL: http://jakarta.apache.org/commons/betwixt/
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: sitemap components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: cgaffga@triplemind.com
                CC: cgaffga@triplemind.com


Could you please add the Transformer to the scratchpad.

> can you briefly explain the differences between the two transformers.
> Whilst I am very familiar with the CastorTransformer (and Castor XML/JDO),
> I'd appreciate a quick overview of the functionality of the
> BetwixtTransformer, and what advantages it would offer to using the
> CastorTransformer.

I just compared some XML-Binding frameworks like JAXB, Castor, XMLBeans,
JiBX etc.
The one I most liked was Betwixt. It is very easy to use, produces SAX
events, it works with EJBs RemoteInterface, easy to use mapping files, clean
XML, supports Maps and Collection in a way I like it. And it is more
Beans-centric, good if you want to use your existing beans (Castor is more
Schema-centric, I think).

Some links:
How does Betwixt compare to technologies like JAXB and Castor?
http://jakarta.apache.org/commons/betwixt/faq.html#comparison

Writing Entity Beans
http://jakarta.apache.org/commons/betwixt/guide/writing.html#EJB

And the javadoc for BetwixtTransformer:

Betwixt transformer marshals a object from the Sitemap, Session, Request
or the Conext into a series of SAX events.
Configuation: The betwixt transformer can be configured to not output
              element reference ids. The default setting is to output
              reference IDs.
<map:transformer
        name="betwixt"
        src="org.apache.cocoon.transformation.BetwixtTransformer">
  <ref-ids>true</ref-ids>
</map:transformer>

Sample:
<root xmlns:betwixt="http://apache.org/cocoon/betwixt-transfomer">
  <betwixt:include name="invoice"/>
  <betwixt:include name="product" scope="sitemap"/>
  <betwixt:include name="product2" element="other-product"/>
</root>

The BetwixtTransfomer support only one Element "betwixt:include".
This element is replaced with the marshalled object. The Object given
through the attribute "name" will be searched in the request, session,
context and at least in sitemap.
If the scope is explicitly given, the object will ge located only there.
The attribute "element" can be given to specify an alternativ
root element for the object. Collections are marshalled by marshalling
each object it contains.