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