cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <>
Subject XML to JavaBean mapping (was: Cocoon, XForms, etc.)
Date Mon, 18 Feb 2002 13:04:15 GMT
Hi, all!

Concluding our discussion on Cocoon/XForms/Struts, I can state that we
definitely need a good XML to JavaBeans mapping/binding framework. What are
the options:

1. Castor (or something like that)
Yes, Castor can do that job and it's fine, but has limits, as it is said at
Castor web site, that for some complicated cases additional XSL
transformation will be required. Also, it seems to me that Castor moves
forward too slowly - 1.5 year ago it was  version 0.8, now it's only
0.9.3... What is the reason: conceptual problems or the version numbering

2. XSLT (especially, using Xalan extensions)
XML to JavaBean mapping and vice versa can can be achieved using XSLT and
scripting. It looks like this:

<?xml version="1.0"?>

  <lxslt:component prefix="mbean">
    <lxslt:script lang="javaclass" src="my.MyBean"/>

  <xsl:template match="server">
    <xsl:value-of select="mbean:server(string(@domain))"/>

  <xsl:template match="mbean">
    <xsl:value-of select="mbean:create(string(@code),string(@name))"/>

  <xsl:template match="mbean/attribute">
    <xsl:value-of select="mbea7n:attribute(string(@name),text())"/>

  <xsl:template match="mbean/operation">
    <xsl:for-each select="parameter">
      <xsl:value-of select="mbean:parameter(text())"/>
    <xsl:value-of select="mbean:operation(string(@name))"/>


So, I think that every complicated case can be handled this way. More over,
it seems that JavaBeans can be instantiated on fly even if they have no
default contructor. The problems I see are perfomance and dependency on a
specific XSLT processor.

3. Something self implemented
As I remember, ExFormula had some Mapper that performs mapping XML data to
JavaBeans. Is there a need for a self implemented framework if ready
solutions can meet the needs?

So, I'd prefer to use the 2nd way - XSLT for data binding. Can anybody
please comment on this? Is there anything that I did not take into account?

Best regards,

Konstantin Piroumian
Leading Software Developer

Protek Flagship LLC
Phone: + 7 095 795 0520 (add. 1288)
Fax: + 7 095 795 0525

To unsubscribe, e-mail:
For additional commands, email:

View raw message