You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by denis queffeulou <de...@wokup.com> on 2006/04/04 17:47:57 UTC
[betwixt] manage list
Sorry I've just read a mail in the archive for the subject [XXX]
I've found the DTD in another archive mail (but still no adder
attribute, which seems to have been replaced with updater ?)
So if I use :
<element name="recipients">
<element name="recipient" property="recipients"
updater="addRecipient"/>
</element>
The addRecipient method is called two times with a *null* parameter.
--
Denis
> Thanks for reply
> It doesn't work, I get no more elements. I cannot found the adder
> attribute in betwixt DTD (found with google, not found in Betwixt doc)
>
> If I only write
> <element name="recipient" property="recipients"/>
>
> I get
> <recipients>6786</recipients>
> <recipients>74754</recipients>
> but no main tag "recipients" as I got when I'm using addDefault, I
> think it's strange.
>
> My problem is resumed as : how to deal with a list of String in
> .betwixt file ?
>
> Is there a reference documentation for dot betwixt files ?
>
> --
> Denis
>
>> Hi denis, try to add /adder='addRecipient//'/ to your element.//
>>
>> denis queffeulou escribió:
>>
>>> Hi all,
>>>
>>> I try to use Betwixt 0.7 to parse this XML (generated by betwixt) :
>>> <SendRequest>
>>> ...
>>> <recipients>
>>> <recipient>09089787767</recipient>
>>> <recipient>767576565</recipient>
>>> </recipients>
>>> ...
>>> </SendRequest>
>>>
>>> the problem is that I get null for each "recipient". I got a bean
>>> that contains a list with 2 null recipients.
>>>
>>> I'm using the .betwixt :
>>> <?xml version='1.0' encoding='UTF-8' ?>
>>> <info primitiveTypes="element">
>>> <element name="SendRequest">
>>> ...
>>> <element name="recipients">
>>> <element name="recipient" property="recipients"
>>> updater="addRecipient"/>
>>> </element>
>>> ...
>>> </element>
>>> </info>
>>>
>>> The bean contains the following methods :
>>>
>>> public List getRecipients()
>>> public void setRecipients(List recipients)
>>> public void addRecipient(String aRecipient)
>>>
>>> I don't understand what is the problem since when I'm using
>>> addDefaults, the generated XML is the same.
>>>
>>> thanks for help
>>> --
>>> Denis
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] manage list
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Wed, 2006-04-05 at 12:22 +0200, denis queffeulou wrote:
> Ok,
> I understand that the addDefaults tag is mandatory otherwise strange
> things happen. I think this is very confusing because the functionning
> of element tag depends on the addDefaults, but anyway...
> So I will put the addDefaults at the end of the .betwixt and manage
> unwanted properties with the hide tag or by using :
> <addDefaults add-properties="false"/>
the addDefaults tag is optional. using it adds the standard heuristics
used by betwixt to guess adders and so on. when it's not present
everything needs to be completely specified.
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] manage list
Posted by denis queffeulou <de...@wokup.com>.
Ok,
I understand that the addDefaults tag is mandatory otherwise strange
things happen. I think this is very confusing because the functionning
of element tag depends on the addDefaults, but anyway...
So I will put the addDefaults at the end of the .betwixt and manage
unwanted properties with the hide tag or by using :
<addDefaults add-properties="false"/>
Thanks
--
Denis
> Hello again denis:
>
> Look if this looks like you wanna get.
>
> Regards.
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>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
Re: [betwixt] manage list
Posted by Marcos Truchado Martín <ma...@hp.com>.
Hello again denis:
Look if this looks like you wanna get.
Regards.
Re: [betwixt] manage list
Posted by denis queffeulou <de...@wokup.com>.
Thanks for sample, it works.
I think I found a difference with my code : the <addDefaults/> tag.
If I delete the addDefaults from your sample, it doesn't work any more
(as mine), no element is output.
I guess I had not understand the meaning of this tag but the problem
with addDefaults is that Betwixt adds all remaining elements. For
example if I use it :
<element name="recipients">
<element name="recipient" property="recipients"
adder="addRecipient" class="java.lang.String"/>
<addDefaults/>
</element>
<element name="shortcode" property="shortcode"/>
I got the following XML which duplicates the shortcode element:
<recipients>
<recipient>09089787767</recipient>
<recipient>767576565</recipient>
<shortcode>67778</shortcode>
</recipients>
<shortcode>67778</shortcode>
My problem is to control the order of the elements and I cannot do it
with the addDefaults tag (?)
--
Denis
> Hello, here is some code for you. This code will create a class with a
> LinkedList. The elements of this list are Strings. The whole structure
> is parsed to XML. I have tried to parse the XML into a bean and it
> works too, and re-parse to XML again. The code is attachement.
>
> Hope this help you.
>
> denis queffeulou escribió:
>
>> Sorry I've just read a mail in the archive for the subject [XXX]
>>
>> I've found the DTD in another archive mail (but still no adder
>> attribute, which seems to have been replaced with updater ?)
>>
>> So if I use :
>> <element name="recipients">
>> <element name="recipient" property="recipients"
>> updater="addRecipient"/>
>> </element>
>>
>> The addRecipient method is called two times with a *null* parameter.
>>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>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
Re: [betwixt] manage list
Posted by Marcos Truchado Martín <ma...@hp.com>.
Hello, here is some code for you. This code will create a class with a
LinkedList. The elements of this list are Strings. The whole structure
is parsed to XML. I have tried to parse the XML into a bean and it works
too, and re-parse to XML again. The code is attachement.
Hope this help you.
denis queffeulou escribi�:
> Sorry I've just read a mail in the archive for the subject [XXX]
>
> I've found the DTD in another archive mail (but still no adder
> attribute, which seems to have been replaced with updater ?)
>
> So if I use :
> <element name="recipients">
> <element name="recipient" property="recipients"
> updater="addRecipient"/>
> </element>
>
> The addRecipient method is called two times with a *null* parameter.
>