You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jeremy Denton <ma...@gmail.com> on 2005/03/19 20:09:14 UTC
[betwixt] root Collections?
Is there any way of specifying root collections in betwixt?
<addressBook>
<person name="bob"/>
<person name="joe"/>
<person name="frank/">
<person name="jim"/>
</addressBook >
The documentation for Betwixt is a bit lacking. (I'll happily
contribute to the Wiki once I figure out how to use it myself).
Otherwise, I'm pleased by the project. There are very few XML Binding
frameworks that leaves your Beans alone.
Cheers,
Jeremy
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] root Collections?
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
you need to set wrapCollectionsInElement to false on the
XmlIntrospection configuration.
this one is in the (current) document (on the website) see
http://jakarta.apache.org/commons/betwixt/guide/binding.html. it's a bit
hard to find stuff but most of the Betwixt functionality is covered
somewhere or other. at the moment, you probably either need to read all
the documentation (or buy a book). an index would be a very welcomed
contribution.
- robert
On Sat, 2005-03-19 at 23:13 -0800, Jeremy Denton wrote:
> Yes, The goal is to have an AddressBook object.
>
> I think I figured it out but I don't know what if three things that
>
> I was trying to avoid having:
>
> <addressBook>
> <personList>
> <person name=joe"/>
> <person name="frank"/>
> </personList>
> </addressBook>
>
> What I want is:
>
> <addressBook>
> <person name=joe"/>
> <person name="frank"/>
> </addressBook>
>
>
> I figured it out but it was one of three things:
>
> 1) adding a removePerson(Person person) method
> 2) <element name="person" property="persons" />
> 3) the structure of my betwixt files.
>
> Jeremy
>
>
> On Mar 19, 2005, at 3:52 PM, Vikram Goyal wrote:
>
> > I am not sure what you mean. Is addressBook a collection of Person
> > objects?
> >
> > java.util.ArrayList addressBook = new java.util.ArrayList();
> > addressBook.add(new Person("Bob"));
> > addressBook.add(new Person("John"));
> > bWriter.write("addressBook", addressBook);
> > bWriter.flush();
> >
> > This should do what you want to do, if I understand you correctly.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
--
robert burrell donkin <ro...@blueyonder.co.uk>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] root Collections?
Posted by Jeremy Denton <ma...@gmail.com>.
Yes, The goal is to have an AddressBook object.
I think I figured it out but I don't know what if three things that
I was trying to avoid having:
<addressBook>
<personList>
<person name=joe"/>
<person name="frank"/>
</personList>
</addressBook>
What I want is:
<addressBook>
<person name=joe"/>
<person name="frank"/>
</addressBook>
I figured it out but it was one of three things:
1) adding a removePerson(Person person) method
2) <element name="person" property="persons" />
3) the structure of my betwixt files.
Jeremy
On Mar 19, 2005, at 3:52 PM, Vikram Goyal wrote:
> I am not sure what you mean. Is addressBook a collection of Person
> objects?
>
> java.util.ArrayList addressBook = new java.util.ArrayList();
> addressBook.add(new Person("Bob"));
> addressBook.add(new Person("John"));
> bWriter.write("addressBook", addressBook);
> bWriter.flush();
>
> This should do what you want to do, if I understand you correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] root Collections?
Posted by Vikram Goyal <te...@craftbits.com>.
Hi Jeremy,
I am not sure what you mean. Is addressBook a collection of Person objects?
java.util.ArrayList addressBook = new java.util.ArrayList();
addressBook.add(new Person("Bob"));
addressBook.add(new Person("John"));
bWriter.write("addressBook", addressBook);
bWriter.flush();
This should do what you want to do, if I understand you correctly.
Otherwise, if you can make your Addressbook a class with a addPerson()
method that adds new Person objects to an internal collection, it will give
you better (and more configurable) results. You can also use the .betwixt
file to override default behaviors.
BTW, there are several books on Commons now available (including mine!):
http://wiki.apache.org/jakarta-commons/JakartaCommonsResources
HTH,
Vikram
---------------------------------------------------------------------------------------
Jakarta Commons Online Bookshelf
Module 5: JXPath and Betwixt:
http://www.manning.com/catalog/view.php?book=goyal5
All Modules: http://www.manning.com/goyal
---------------------------------------------------------------------------------------
----- Original Message -----
From: "Jeremy Denton" <ma...@gmail.com>
To: <co...@jakarta.apache.org>
Sent: Sunday, March 20, 2005 5:09 AM
Subject: [betwixt] root Collections?
>
> Is there any way of specifying root collections in betwixt?
>
> <addressBook>
> <person name="bob"/>
> <person name="joe"/>
> <person name="frank/">
> <person name="jim"/>
> </addressBook >
>
>
> The documentation for Betwixt is a bit lacking. (I'll happily contribute
> to the Wiki once I figure out how to use it myself).
>
> Otherwise, I'm pleased by the project. There are very few XML Binding
> frameworks that leaves your Beans alone.
>
> Cheers,
> Jeremy
>
>
> ---------------------------------------------------------------------
> 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