Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
                      xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
                      xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">

    <!--
    Use a FreeMarker template to perform the model driven transformation.  You can also inline the template here.
    -->
    <resource-config selector<ftl:freemarker applyOnElement="$document">
        <resource><ftl:template>/example/templates/HistoryTrans.ftl</resource>ftl:template>
    </resource-config>ftl:freemarker>

    <!--
    Configure the History bean creation and population.
    -->
    <jb:bindings beanId="history" class="example.model.ShippingHistory" createOnElement="history">
        <jb:wiring property="warehouse" beanIdRef="warehouse"/>
        <!-- Note the date decoder is not configured with a format.  Will therefore use the default (SOAP).  See DateDecoder class. -->
        <jb:value property="creationDate" decoder="Date" data="header/date" />
        <!-- Note the "special" decoder for the trackingNumbers. -->
        <jb:value property="trackingNumbers" decoder="example.model.TrackingNumberDecoder" data="history/trackingNumbers" />
    </jb:bindings>

    <!--
    Configure the Warehouse bean creation and population.
    Note how we create it on visiting the history element and set the bean on
    history element (will set it based on it's own beanId).
    -->
    <jb:bindings beanId="warehouse" class="example.model.Warehouse" createOnElement="history">
        <jb:value property="id" decoder="Integer" data="history/@warehouse" />
        <!-- Note the "special" decoder for mapping the warehouse id. -->
        <jb:value property="name" decoder="Mapping" data="history/@warehouse">
            <jb:decodeParam name="1">Dublin</jb:decodeParam>
            <jb:decodeParam name="2">Belfast</jb:decodeParam>
            <jb:decodeParam name="3">Cork</jb:decodeParam>
        </jb:value>
    </jb:bindings>

</smooks-resource-list>

...

No Format
    <!--
    Use a FreeMarker template to perform the model driven transformation.  You can also inline the template here.
    -->
    <resource-config selector<ftl:freemarker applyOnElement="$document">
        <resource><ftl:template>/example/templates/HistoryTrans.ftl</resource>ftl:template>
    </resource-config>ftl:freemarker>

And the actual template can be seen here. Note how concise the template is.

...