Initially, I did generate the descriptor classes. The issue I
encountered was that the descriptor classes were generated in a package
like "com.xyz.descriptors" and there were many classes classes that
were
generated in "com.xyz" package that were referring to the descritpor
classes in "com.xyz.descriptors" package without having the appropriate
import statements. This was causing compilation errors. For lack of
time, I circumvented this by not generating the descriptors.
Now, any idea why the classes do not have the necessary import
statements for the descriptor classes? Am I missing something very
basic here?
Thanks for any help here...
Raghavan Eachampadi
------------------------------------------------------------------------
*From:* Werner Guttmann [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, April 17, 2007 12:40 AM
*To:* [email protected]
*Subject:* AW: [castor-user] XML:Unmarshaller creates an empty java
object (all null values) - castor 1.1
Is there any particular reason why you are **not** generating the
descriptor classes where Castor maintains the XML to Java object
binding
information ? I know that Castor does support introspection during
‘class descriptor resolution’, but by not generating the class
descriptors, you are basically instructing Castor not to use the most
valuable piece of information (that has been derived from the original
XML schema(s) during generation).
Werner
------------------------------------------------------------------------
*Von:* Raghavan Eachampadi [mailto:[EMAIL PROTECTED]
*Gesendet:* Montag, 16. April 2007 23:18
*An:* [email protected]
*Betreff:* [castor-user] XML:Unmarshaller creates an empty java object
(all null values) - castor 1.1
Hi,
I am using castor 1.1 with JDK 6. I've used the xml source
generator to
generate java classes for the XML schemas. I've used the option
-nodesc
in the source generator to not create any descriptor classes. Also, I
do not have any mapping.xml file that I use.
When I use the static method Unmarshaller.unmarshall() to create a java
object from an xml document instance, I see that all the members fields
of the instantiated object is null.
Any pointers/help is greatly appreciated.
Here is my code listing:
*try* {
Reader xmlReader = *new* FileReader(xmlInstance); /* xmlInstance is the
String containing the xml file name that is being unmarshalled */
EntityDescriptor metaDataObj =
(EntityDescriptor)(Unmarshaller./unmarshal/(EntityDescriptor.*class*,
xmlReader)); /* EntityDescriptor is the class corresponding to the
root
of the xml file being unmarshalled -- metaDataObj is a non null object
but all its members are uninitialized (basically null) */
isValid = metaDataObj.isValid(); /* This method returns true */
} *catch* (FileNotFoundException fnfex) {
**throw** *fnfex;*
} *catch* (org.exolab.castor.xml.ValidationException vex) {
*throw* *vex;*
} *catch* (MarshalException mex) {
*throw* *mex;*
}
Raghavan Eachampadi