You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by sa...@ig.com.br on 2004/06/22 15:14:58 UTC

Betwixt (XML tags not sorted)

Hello, 

I'm using Betwixt to transform my classes in XML. 
But the tags that Betwixt creates are sorted alphabetically. What can I do 
to generate tags without sorting or at least sorted the way I want? 

Other problem. 
When a attribute of a classe is empty, Betwixt shows me the tags like this 
<emptyTag/>. 
Is there a way to show tags like this? <emptyTag></emptyTag> 

Sorry my mistakes. I'm not good at English. 

Thanks. 

_________________________________________________________________________________
Quer mais velocidade?
S� com o acesso Aditivado iG, a velocidade que voc� quer na hora que voc� precisa.
Clique aqui: http://www.acessoaditivado.ig.com.br



Re: Betwixt (XML tags not sorted)

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 22 Jun 2004, at 14:14, santana.beto@ig.com.br wrote:

> Hello,

hi

> I'm using Betwixt to transform my classes in XML.
> But the tags that Betwixt creates are sorted alphabetically. What can 
> I do
> to generate tags without sorting or at least sorted the way I want?

unless you specify the mapping in a dot betwixt file (or map a bean 
with a BeanInfo), the order of the elements is determined by the way in 
which your JVM orders your bean's properties. since different JVMs 
choose different orders, this is a major PITA.

it's not very easy to obtain the actual order of the properties in the 
source file (does anyone know if this is actually possible using 
reflection?) but one of the betwixt long term TODO's has been to add a 
strategy plug to allow programmatic control over element order. it 
should be pretty easy to write and usually i'd step up but i'm very 
busy right now with multiple releases. maybe you'd like to give this 
task a go or maybe someone will step up but otherwise you'll have to 
create .betwixt files to specify the mapping.

> Other problem.
> When a attribute of a classe is empty, Betwixt shows me the tags like 
> this
> <emptyTag/>.
> Is there a way to show tags like this? <emptyTag></emptyTag>

if you can update to CVS HEAD or grab the next nightly, i've just added 
this enhancement (but i don't have time to add any docs about it right 
now). BeanWriter has a new property called endTagForEmptyElement. if 
you set this to true then empty tags should come out the way you need.

(hopefully i'll find time to write this feature up tomorrow.)

- robert


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