commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Ward" ...@whatsa.co.uk>
Subject Re: [Betwixt] Collections' element names
Date Mon, 06 Jan 2003 15:12:01 GMT
Apologies for not doing more investigation before asking my last question.

I found all I needed at
http://jakarta.apache.org/commons/betwixt/overview.html

Ed.

----- Original Message -----
From: "Ed Ward" <ed@whatsa.co.uk>
To: <commons-user@jakarta.apache.org>
Sent: Monday, January 06, 2003 12:32 PM
Subject: [Betwixt] Collections' element names


> Individual elements of a collection seem to be named after the class of
the
> object in the collection. I have a collection of objects that all
implement
> the same interface, but may be of different types. Is there a way to get
> betwixt to output the collection using the name of the interface the
objects
> are implementing? Similarly if the objects in the collection all extend a
> common base class is it possible to have all elements named after the
common
> base class?
>
> This example is a bit contrived but ..
>
>     public Collection getNames()
>     {
>         Collection c = new ArrayList();
>         c.add("janet");
>         c.add(new StringBuffer("john"));
>         return c;
>     }
>
> will produce something like ..
>
> <names>
>     <String>janet</String>
>     <StringBuffer>john<StringBuffer>
> </names>
>
> is it possible to get betwixt to output ..
>
> <names>
>     <String>janet</String>
>     <String>john<String>
> </names>



Mime
View raw message