Thx. It worked. But I am lost on why this strange naming convention. I am sure 
you have explained this many times. When I use source generator with my xsd 
having an element as "BalanceInfo" it generates a class called 
"BalanceInfo.java". In my case, I had to generate the source using -nomarshall 
and -nodesc. This is because of GWT having problems serializing castor classes 
etc. But I am not sure why Castor would generate source as defined in xsd but 
then expect the element in the actual xml to be different. Also what happens 
during marshalling ? I will try it out.

Thx

-- pady


> Date: Tue, 8 Jan 2008 00:56:57 +0100
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: [castor-user] unmarshall with custom classes...
> 
> Sure. The default naming conversion will translate the class name 
> BalanceInfo.java to <balance-info>.
> 
> Wernerhe
> 
> Pady Srinivasan wrote:
> > 
> > I know the issue. But not the solution. My child element was actually 
> > "BalanceInfo" with an equivalent class "BalanceInfo.java". Even if I 
> > chane my element name from "<BalanceInfo" to "<balanceInfo>" or 
> > "<balanceinfo"  castor is not able to figure out the class and I get a 
> > null. If I change the class to "Balance" and use "<balance>" everything 
> > works. Any ideas ?
> > 
> > Thx
> > 
> > -- pady
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> >  > Date: Tue, 8 Jan 2008 00:19:59 +0100
> >  > From: [EMAIL PROTECTED]
> >  > To: [email protected]
> >  > Subject: Re: [castor-user] unmarshall with custom classes...
> >  >
> >  > No idea. Mind posting the relevant code fragments, i.e. Java classed and
> >  > XML document instances.
> >  >
> >  > Werner
> >  >
> >  > Pady Srinivasan wrote:
> >  > >
> >  > > I tried changing <Balance> to <balance> and I still get a null for the
> >  > > Balance reference.
> >  > >
> >  > > Thx
> >  > >
> >  > > -- pady
> >  > >
> >  > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > > Date: Mon, 7 Jan 2008 21:33:18 +0100
> >  > > > From: [EMAIL PROTECTED]
> >  > > > To: [email protected]
> >  > > > Subject: Re: [castor-user] unmarshall with custom classes...
> >  > > >
> >  > > > Yes, use a mapping file. The problem is that you are *not* using a
> >  > > > mapping file, and as such Castor will be using introspection to
> >  > > > determine a mapping between Java objects and XML artefacts. For 
> > this to
> >  > > > work, Castor is using some default naming convention, whereupon 
> > it will
> >  > > > e.g. assume that the artefact mapped to the Java class Balance is 
> > named
> >  > > > <balance> (and not <Balance>).
> >  > > >
> >  > > > T overcome this problem, either define a mapping for these
> >  > > > classes/members, or consider changing the XML to meet the default 
> > naming
> >  > > > conventions for introspection mode.
> >  > > >
> >  > > > Regards
> >  > > > Werner Guttmann
> >  > > >
> >  > > > Pady Srinivasan wrote:
> >  > > > >
> >  > > > > Hi. I have custom classes and would like to unmarshall an xml 
> > to java
> >  > > > > objects. The xml is as follows:
> >  > > > >
> >  > > > > <Account>
> >  > > > > <id>324</id>
> >  > > > > <Balance>
> >  > > > > <amount>23.34</amount>
> >  > > > > </Balance>
> >  > > > > </Account>
> >  > > > >
> >  > > > > My unmarshall code is as follows:
> >  > > > >
> >  > > > > FileReader reader = new FileReader("account.xml");
> >  > > > > Account account = Unmarshaller.unmarshall(Account.class, reader);
> >  > > > >
> >  > > > > When I try to do a account.getBalance(), I get a "null" instead 
> > of a
> >  > > > > Balance object. Account.java and Balance.java are Serializable 
> > objects
> >  > > > > and exist in the same package. Using Castor 1.1. Anything 
> > special I
> >  > > need
> >  > > > > to do ?
> >  > > > >
> >  > > > > Thx
> >  > > > >
> >  > > > > -- pady
> >  > > > >
> >  > > > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > > > Get the power of Windows + Web with the new Windows Live. Get 
> > it now!
> >  > > > > 
> > <http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_012008>
> >  > > >
> >  > > >
> >  > > >
> >  > > > ---------------------------------------------------------------------
> >  > > > To unsubscribe from this list please visit:
> >  > > >
> >  > > > http://xircles.codehaus.org/manage_email
> >  > > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > Watch “Cause Effect,” a show about real people making a real 
> > difference.
> >  > > Learn more 
> > <http://im.live.com/Messenger/IM/MTV/?source=text_watchcause>
> >  >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list please visit:
> >  >
> >  > http://xircles.codehaus.org/manage_email
> >  >
> > 
> > ------------------------------------------------------------------------
> > Put your friends on the big screen with Windows Vista® + Windows Live™. 
> > Start now! 
> > <http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_012008>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 

_________________________________________________________________
Make distant family not so distant with Windows Vista® + Windows Live™.
http://www.microsoft.com/windows/digitallife/keepintouch.mspx?ocid=TXT_TAGLM_CPC_VideoChat_distantfamily_012008

Reply via email to