I think it would be better if 'nspackages' were added into castor.properties and UnmarshalHandler paid attention to it.
You are right. The UnmarshalHandler is not tied to the builder, but it is tied to the namespaces. Otherwise it cannot find the right classes. IMHO this is much better than xsi:type usage because you'll still have the namespace concept. Any comments? I am not familiar with Castor mappings. How is this problem handled in that usage? Ozgur > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of > Keith Visco > Sent: Sunday, December 23, 2001 12:02 AM > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] namespace checking in UnmarshalHandler > > > > The UnmarshalHandler doesn't check the castor.properties for > > org.exolab.castor.builder.nspackages=\ > namespace1=java.namespace1,\ > namespace2=java.namespace2 > > because that property is only supposed to appear in > castorbuilder.properties. > > It's used when creating Java source code. > > The UnmarshalHandler isn't tied into the builder, so it doesn't check > the castorbuilder.properties file. > > --Keith > > > Ozgur Balsoy wrote: > > > > I have solved my problem. Now, UnmarshalHandler, right before creating > > AnyNode objects for unrecognized types, checks if the namespace > is assigned > > to a Java package in the properties file. If so, it initiates > an instance of > > the right class. > > > > This has resulted that now Marshaller prints out > > xsi:type="java:package_name" attribute for the object, which is > something I > > don't mind because if I unmarshal these XML documents, Castor > works fine. > > > > So, now I want Marshaller to work the same way. Before > processing the object > > for xsi:types, it should check the properties file for > namespace packages, > > and assign the right namespace to the object. It should use > object's marshal > > method/class descriptor/whatever if there is any. > > > > Marhsaller's code looked more confusing than UnmarshalHandler. > Developers? > > Do you have any hint for where to start? > > > > Ozgur Balsoy > > Pervasive Technology Labs > > Indiana University > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of > > > Ozgur Balsoy > > > Sent: Thursday, December 20, 2001 2:49 PM > > > To: [EMAIL PROTECTED] > > > Subject: [castor-dev] namespace checking in UnmarshalHandler > > > > > > > > > > > > Hi there, > > > I was wondering why UnmarshalHandler does not check properties > > > file to find > > > package and class names. I have this XML: > > > > > > <section xmlns="namespace1" xmlns:cg="namespace2"> > > > <title>my title</title> > > > <cg:screen view="portal" link="relative"/> > > > </section> > > > > > > In castor.properties, I give: > > > > > > org.exolab.castor.builder.nspackages=\ > > > namespace1=java.namespace1,\ > > > namespace2=java.namespace2 > > > > > > In schema, section element has 'any' group after 'title'. > When I unmarshal > > > 'section', UnmarshalHandler finds the namespace of cg:screen > fine but it > > > does not check the above packages, rather it unmarshals it as > an AnyNode. > > > > > > Ozgur > > > > > > ----------------------------------------------------------- > > > If you wish to unsubscribe from this mailing, send mail to > > > [EMAIL PROTECTED] with a subject of: > > > unsubscribe castor-dev > > > > > > > > > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send mail to > > [EMAIL PROTECTED] with a subject of: > > unsubscribe castor-dev > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
