Hi Dan,

My first reaction was that you're right - but then I realized there 
actually is a simpler (but unintuitive) way. You can use a pre-set 
method to basically hook into the unmarshalling of the element, and in 
that method process the attributes. You can also use a pre-get method to 
do the reverse on the output side. The pre-set method will be called 
while the unmarshaller is positioned on the start tag of the element 
(assuming there *is* an element associated with the object), and the 
pre-get method will be called while the writer is positioned on the 
start tag of the element (likewise).

The only hitch is that I'm not officially guaranteeing this behavior as 
of now - but I use it in the code I'm writing, including the new version 
of the JiBX tools.

  - Dennis

Dennis M. Sosnoski
SOA, Web Services, and XML
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117



Dan Cooperstock wrote:
> I think you will almost certainly have to use a custom unmarshaller.
>
> -------------------------------------------------------------------
> Dan Cooperstock, Senior Software Developer, Quest Software
> 260 King St. E., Toronto ON Canada  M5A 4L5
> [EMAIL PROTECTED]    416-933-5165
>  
> With Quest Software, you get more ... more performance, more
> productivity, more value from your IT investments.
>
> Visit www.quest.com to learn more.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rueegg
> Alexander
> Sent: Wednesday, June 07, 2006 11:47 AM
> To: jibx-users@lists.sourceforge.net
> Subject: [jibx-users] Mapping attributes to one collection
>
> Hi all,
>  
> i have problems dealing with the following situation. I have a simple
> xml file like this:
>
> <tagA name="myName">
>   <tagB attributeA="6000" attributeB="200" attributeC="5"
> attributeD="100"/>
> </tagA>
>
> 'tagA' should be mapped to class 'A' and the attributes of 'tagB' should
> be mapped to a collection of a class 'B' (so each attribute should
> result in an instance of class 'B'):
> public class A
> {
>     public String name;
>     public Collection<B>;
> {
>
> public class B
> {
>     public String field1;
>     public Integer field2;
> }
>
> How can I achieve this? I searched the mailing list archive but could
> not find an answer.
>
> thank you in advance.
> Alex
>
>
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to