commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [betwixt] WrapCollectionsInElement ignored when element is specified in .betwixt file
Date Wed, 05 May 2004 19:59:31 GMT
hi George

i know that this probably isn't very intuitive but the wrapping only 
effects those elements which are added automatically. the idea is that 
you can easily add wrapper elements in a betwixt file. (i think that 
this is explain in 
http://jakarta.apache.org/commons/betwixt/guide/binding.html - if it 
isn't then please let me know or even better contribute a patch :)

BTW ordering is something that was always intended to be a pluggable 
strategy. maybe something like

public abstract class ElementDescriptorOrderer

/**
  * Provides ordering for the child elements of the given descriptor.
  * @param descriptor ElementDescriptor, not null
  * @return Comparator (for ElementDescriptors) to order the given 
descriptor
  */
public abstract Comparator order(ElementDescriptor descriptor);

the idea is that towards the end of the introspection, the strategy 
would be called and the descriptors re-ordered.

comments anyone?

even better, any volunteers to have a go at an implementation? (it's 
easy, i promise but it's now critical that beanutils and digester are 
sorted out ready for their next releases so those components are going 
to be my priority over the next few days.)

- robert

On 5 May 2004, at 07:10, George Papastamatopoulos wrote:

> Hi
>
> Im having some troubles that hopefully someone can help me with.  I 
> have a bean that I'm converting to xml, but want to control the order 
> of the xml elements, and their names, so I've defined a .betwixt file 
> to do this.
>
> <beanSnippet>
> ...
>  public List getMyElements()
>  {
>     return elements;
>  }
> </beanSnippet>
>
> <.betwixtSnippet>
> ..
> <element name="newNames" property="myElements"/>
> <.betwixtSnippet>
>
> Problem is, that when I specify the property as an element, betwixt 
> doesn't wrap the collection in a containing element, even though I've 
> specfied the wrapCollectionsInElement property to be true, but rather 
> renders each individual element as "<newNames .../>".  When I remove 
> the reference from the betwixt file, I get what I'm after (elements, 
> wrapped in a containing element).
>
> <myElements>
>  <myElement/>
> ...
> </myElements>
>
> Is this expected behaviour?  Am I missing something?  Am Im able to 
> define elements in the betwixt file and still get the behaviour I'm 
> after.
> Thanks for listening.
> George
>
> -- 
> ___________________________
> George Papastamatopoulos
>
> Lawlex Compliance Solutions
> +61 3 9278 1182
> ___________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


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


Mime
View raw message