Hi,
My unmarshaller.unmarshal as follows is returning AnyNode objects. I want
this to return an arraylist of EqfAvailibityItem objects. Can anyone please
help?
public <T> ArrayList<T> retrieveListFromExcelFile() {
ArrayList<T> components = new ArrayList<T>();
// Generate XML Data From Excel
excelToXMLTransform.generateXML();
Mapping mapping = new Mapping();
try {
log.info("Mapping the XML data from " +
inputXMLFileName + " to Java
Objects");
mapping.loadMapping(mappingFile);
Unmarshaller unmarshaller = new
Unmarshaller(ArrayList.class);
unmarshaller.setMapping(mapping);
components = (ArrayList<T>) unmarshaller.unmarshal(new
FileReader(inputXMLFileName));
} catch (MappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MarshalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ValidationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return components;
}
I am using a mapping file as follows:
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
1.0//EN" "http://castor.exolab.org/mapping.dtd">
<mapping>
<description>A mapping file for our Address Book application</description>
<class name="com.EqfAvailibityItem">
<field name="clientCode" type="string">
<bind-xml name="Client_Code" node="element"></bind-xml>
</field>
<field name="secCode" type="string" >
<bind-xml name="sec_code" node="element"></bind-xml>
</field>
<field name="secName" type="string" >
<bind-xml name="sec_name" node="element"></bind-xml>
</field>
<field name="secDesc" type="string" >
<bind-xml name="sec_desc" node="element"></bind-xml>
</field>
<field name="insID" type="string" >
<bind-xml name="Instr_Id" node="element"></bind-xml>
</field>
<field name="issueCcy" type="string" >
<bind-xml name="issue_ccy" node="element"></bind-xml>
</field>
<field name="quantity" type="int" >
<bind-xml name="Quantity" node="element"></bind-xml>
</field>
</class>
</mapping>
--
View this message in context:
http://www.nabble.com/unmarshaller.unmarshal-returning-AnyNode-objects-tp16698575p16698575.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email