Thanks a lot for your help.
 
Using the container attribute works wonderfully - it works with arrays too.
 
Once again, I'm amazed with what I can accomplish by using castor.
 
-Nischala

        -----Original Message----- 
        From: Keith Visco [mailto:[EMAIL PROTECTED] 
        Sent: Thu 6/17/2004 1:47 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: Re: [castor-user] [XML] Skip generating an element
        
        



        David,
        
        See my reply, container="true" should work in this case and would be
        easier than creating a FieldHandler.
        
        --Keith
        
        David Leangen wrote:
        >
        > Ok, sorry my last reply didn't help.
        >
        > Don't take my word for it... but it sounds like you'll need to implement 
your own handler, then.
        >
        > See: http://www.castor.org/xml-mapping.html#7.2-Create-your-own-FieldHandler
        >
        > In your getValue and setValue methods, I suppose that you would write 
something like:
        >
        >   return ((Zoo)object).getFoo();
        >
        > and
        >
        >   ((Zoo)object).setFoo((Foo)value);
        >
        > Let me know if that does the trick.
        >
        > > -----Original Message-----
        > > From: Nischala Kale [mailto:[EMAIL PROTECTED]
        > > Sent: June 18, 2004 3:02
        > > To: [EMAIL PROTECTED]
        > > Subject: Re: [castor-user] [XML] Skip generating an element
        > >
        > >
        > > I tried using transient attribute - it supresses generating xml
        > > for the method - and any subsequent classes as well..
        > >
        > > The mapping file looks similar to -
        > > <class name="foo">
        > >   <field name="zoo" />
        > > </class>
        > > <class name="zoo">
        > >   <field name="bar"/>
        > > </class>
        > >
        > > As expected, this will generate <foo><zoo><bar/></zoo></foo>
        > > I wanted to be able to skip generating zoo, but still get bar.
        > > If  I use the transient attribute, I get <foo/>
        > >
        > > The reason I was looking for functionality as above is that while
        > > we are following an industry standard schema to work with other
        > > companies, there is this one company that does not follow the
        > > standard schema. To be able to generate xml for them, I need to
        > > write a mapping file that is able to skip over certain elements,
        > > and add their children to the parent element instead.
        > >
        > > Thanks
        > >
        > >
        > >       -----Original Message-----
        > >       From: David Leangen [mailto:[EMAIL PROTECTED]
        > >       Sent: Thu 6/17/2004 12:14 AM
        > >       To: [EMAIL PROTECTED]
        > >       Cc:
        > >       Subject: Re: [castor-user] [XML] Skip generating an element
        > >
        > >
        > >
        > >
        > >       Well, I'm not actually using the mapping files, but I
        > > noticed the following in the doc in the description of the
        > > <field> element:
        > >
        > >        "transient: if true, this field will be ignored during the
        > > marshalling.
        > >         This is usefull in when used with the auto-complete option."
        > >
        > >
        > >       Did you try that?
        > >
        > >
        > >
        > >
        > >       > -----Original Message-----
        > >       > From: Nischala Kale [mailto:[EMAIL PROTECTED]
        > >       > Sent: June 17, 2004 15:48
        > >       > To: [EMAIL PROTECTED]
        > >       > Subject: [castor-user] [XML] Skip generating an element
        > >       >
        > >       >
        > >       > I've been struggling with the following issue for sometime.
        > >       >
        > >       > The class structure is as follows -
        > >       >
        > >       > Class foo has a Method zoo getZoo()
        > >       >
        > >       > Class zoo has a Method bar getBar()
        > >       >
        > >       > But the XML that needs to be generated is like -
        > >       >
        > >       > <foo>  <bar>  </bar> </foo> i.e, the element zoo needs to
        > > to be skipped.
        > >       >
        > >       > Any idea on how I can write a mapping file to achieve this ?
        > >       >
        > >       >
        > >       >
        > >       > Thanks!
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >       >
        > >
        > >
        > >
        > >
        >
        >   ------------------------------------------------------------------------
        > -----------------------------------------------------------
        > If you wish to unsubscribe from this mailing, send mail to
        > [EMAIL PROTECTED] with a subject of:
        >         unsubscribe castor-user
        
        
        
        -----------------------------------------------------------
        If you wish to unsubscribe from this mailing, send mail to
        [EMAIL PROTECTED] with a subject of:
                unsubscribe castor-user
        

<<winmail.dat>>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to