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