Hi,All
How to fetch Objects of specific type other than the root element directly
using the Unmarshall Method.
Example my XML file is say (A.xml) -
<A>
<B>
<color>"Red"</colr>
</B>
</A>
Mapping file is say (map.xml)-
<mapping>
<class name="A">
<map-to xml="A"/>
<field name="B" type="B">
<bind-xml name="B" node="element"/>
</field>
</class>
<class name="B">
<field name="color" type="java.lang.String">
<bind-xml name="color" node="element"/>
</field>
</class>
<mapping>
Then when i do the following to fetch B directly -
Mapping mapping = new Mapping();
mapping.loadMapping("map.xml");
Unmarshaller unmar = new Unmarshaller(B.class);
obj = unmar.unmarshal(new InputSource(new FileReader(strInXML)));
OR
Unmarshaller.unmarshal(B.class,new InputSource(new FileReader(strInXML)));
I get a NullPointer Exception.
Can someone lemme know how do i go about fetching B directly without
fetching A(root element) then doing a getObject on it for B.(This way it
works)
Thanx in Adavnce!!
Anuj
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev