That would require change of my data model. I am using castor to allow 
different application with diffrent data model communicate with each.  Changing 
my model would create a coupling again.
It seems to be possible to grab a parent id and list of children and create a 
proxy object (of course if it would work, I wouldn't have this problem).  It 
seems like I am missing something in logic of nested class.  How can I debug 
this

        <field name='foo'>
             <bind-xml name='Foo'>
                <class name='MyMap'>
                    <field name='id' type='int'>
                        <bind-xml name='id' node='attribute' />
                    </field>
                    <field name='childName' type='java.lang.String'>
                        <bind-xml name='name' node='attribute' />
                    </field>
                </class>
            </bind-xml>
        </field> 

----- Original Message ----
From: Ralf Joachim <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, March 5, 2008 10:56:05 AM
Subject: Re: [castor-user] Flattening structure for XML

Hi Farhad Ch,

as far as I can tell this isn't possible as long as the child does not
know its parent. If you add such a reference you have 2 possibilities:

- add getter and setter methods for the parents property at the child
- try to add a field mapping for 'parent.id' at class mapping of child

Regards
Ralf


farhad ch schrieb:
> Does anybody know how to do this?  Problem is children referencing an
> attribute of parent.
> 
> ----- Original Message ----
> From: farhad ch <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, March 4, 2008 7:49:20 AM
> Subject: Re: [castor-user] Flattening structure for XML
> 
> public class Foo {
>   private int id;
>   private List<Child> children;
>   public Foo(int id, List<Child> children){
>      this.id <http://this.id> = id;
>      this.children = children;
>   }
> //add setter and getters here
> }
> 
> public class Child {
>      private String name;
>      public Child(String name){
>         this.name <http://this.name> = name;
>     }
>     //add setter and getters here
> }
> 
> Caller class is something like:
>     List foos = new ArrayList<Foo>();
> 
>     List<Child> children1 = new ArrayList<Child>();
>     children1.add(new Child("a"));
>     children1.add(new Child("b"));
>     children1.add(new Child("c"));
>     Foo foo1 = new Foo(1,children1);
>     foos.add(foo1);
> 
>     List<Child> children2 = new ArrayList<Child>();
>     children2.add(new Child("aa"));
>     children2.add(new Child("bb"));
>     children2.add(new Child("cb"));
>     Foo foo2 = new Foo(2,children2);
>     foos.add(foo2);
> 
> I need to [un]Marshall foos like below as communication between two
> separate systems:
> <Foos>
>   <Foo id="1" childName="a"/>
>   <Foo id="1" childName="b"/>
>   <Foo id="1" childName="c"/>
>   <Foo id="2" childName="aa"/>
>   <Foo id="2" childName="bb"/>
>   <Foo id="2" childName="cc"/>
> </Foos>
> 
> 
> ----- Original Message ----
> From: Werner Guttmann <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, March 4, 2008 4:55:59 AM
> Subject: Re: [castor-user] Flattening structure for XML
> 
> Not sure whether I understand you correctly. What does do the objects
> look like ?
> 
> Werner
> 
> farhad ch wrote:
>> I have list of objects like "Foo" which contains an "id" attribute and a
>> collection of children and want to flat them during marshaling:
>>
>> public class Foo{
>>  int id;
>>  List<Children> children
>> }
>> Creating a nested list is not complex but I would like to have something
>> like:
>> <Foos>
>>  <Foo id="1" childName="a"/>
>>  <Foo id="1" childName="b"/>
>>  <Foo id="1" childName="c"/>
>>  <Foo id="2" childName="aa"/>
>>  <Foo id="2" childName="bb"/>
>>  <Foo id="2" childName="cc"/>
>> </Foos>
>> How can you map these?
>>
>> ------------------------------------------------------------------------
>> Never miss a thing. Make Yahoo your homepage.
>> <http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 
> ------------------------------------------------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
> <http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
> 
> 
> ------------------------------------------------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> it now.
> <http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>

-- 

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email








      
____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

Reply via email to