You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Holger Haag <ho...@herr-der-mails.de> on 2006/06/14 10:36:18 UTC

[betwixt] Summary feature

Hi,

I am looking for a betwixt feature I call "summary" having found no better term.

Requirements are as follows:

A air fare list is converted to the following XML:

<fareList> 
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="123.45" currency="EUR"/>
  </fare>
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="200.45" currency="EUR"/>
  </fare>
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="323.45" currency="EUR"/>
  </fare>
</fareList

Now it happens that codes like "JFK" (JFK stands for New York John F. Kennedy aiport) are not necessarily self-describing, and there is a lot of information related to an airport, e.g. name, city, country, web site, weather conditions etc.

This information should also be included in the XML document, but in a separate section - to keep the XML document smaller.

So the XML should really look like:


<fareList> 
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="123.45" currency="EUR"/>
  </fare>
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="200.45" currency="EUR"/>
  </fare>
  <fare>
    <departure code="SXF"/>
    <destination code="JFK"/>
    <price amount="323.45" currency="EUR"/>
  </fare>
  <summary>
    <airports>
      <airport>
        <code>JFK</code>
        <name>John F. Kennedy International</name>
        <city>New York</city>
        <state>New York</state>
        <country isoCode="US">United States of America</country>
      </airport>
    </airports>
  </summary>
</fareList

Such an XML structure can of course already be built via betwixt, but my application has this kind of requirements in a couple of XML documents and I don't want to browse the object tree for each and every bean to find out which airports are contained. 

In fact an elegant way would be to have 

(1) a bean collector which is called whenever a bean is converted to XML

(2) a summary builder which uses the collected beans to build a summary

is this (or something similar) already available in betwixt ? If not I'm willing to put some work into and contribute the appropriate SVN patches.

Rgds
Holger
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [betwixt] Summary feature

Posted by Stefano Orselli <st...@postecom.it>.
Ciao Robert,
i want transform a bean to an xml file.
After i process this file with fop.
I want transform an array or a collection to a list of tag in the xml file.
but i want that the tag has a numeration.
example
<element1>
    <name>Francesca</name>
</element1>
<element2>
    <name>Stefano</name>
......
Now i don't find a solution.
thanks
Ciao
Stefano

----- Original Message ----- 
From: "robert burrell donkin" <rd...@apache.org>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Thursday, June 22, 2006 12:08 AM
Subject: Re: [betwixt] Summary feature



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [betwixt] Summary feature

Posted by robert burrell donkin <rd...@apache.org>.
On Wed, 2006-06-14 at 10:36 +0200, Holger Haag wrote:
> Hi,

hi Holger

sorry for such a tardy reply (been very busy with ApacheCon EU stuff) 

> I am looking for a betwixt feature I call "summary" having found no better term.
> 
> Requirements are as follows:
> 
> A air fare list is converted to the following XML:
> 
> <fareList> 
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="123.45" currency="EUR"/>
>   </fare>
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="200.45" currency="EUR"/>
>   </fare>
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="323.45" currency="EUR"/>
>   </fare>
> </fareList
> 
> Now it happens that codes like "JFK" (JFK stands for New York John F. Kennedy aiport) are not necessarily self-describing, 
> and there is a lot of information related to an airport, e.g. name, city, country, web site, weather conditions etc.
> 
> This information should also be included in the XML document, but in a separate section - to keep the XML document smaller.
> 
> So the XML should really look like:
> 
> 
> <fareList> 
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="123.45" currency="EUR"/>
>   </fare>
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="200.45" currency="EUR"/>
>   </fare>
>   <fare>
>     <departure code="SXF"/>
>     <destination code="JFK"/>
>     <price amount="323.45" currency="EUR"/>
>   </fare>
>   <summary>
>     <airports>
>       <airport>
>         <code>JFK</code>
>         <name>John F. Kennedy International</name>
>         <city>New York</city>
>         <state>New York</state>
>         <country isoCode="US">United States of America</country>
>       </airport>
>     </airports>
>   </summary>
> </fareList
> 
> Such an XML structure can of course already be built via betwixt, but my application has this kind of requirements 
> in a couple of XML documents and I don't want to browse the object tree for each 
> and every bean to find out which airports are contained. 
> 
> In fact an elegant way would be to have 
> 
> (1) a bean collector which is called whenever a bean is converted to XML
> 
> (2) a summary builder which uses the collected beans to build a summary
> 
> is this (or something similar) already available in betwixt ? If not I'm willing to put some work into and contribute the appropriate SVN patches.

sounds good :-)

similar problems have been solved by using ID-IDREF magic using a custom
IdStoringStrategy. 

(sorry for not being to find very much time ATM)

- robert