commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <rdon...@apache.org>
Subject Re: [betwixt] Summary feature
Date Wed, 21 Jun 2006 22:08:19 GMT
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

Mime
View raw message