B
BuddahBelly
I am having problems Marshalling more then one class (of the same
type) at a time. Marshalling one class I can do. However when I want
to Marshal more then one instance i get this error in the XML
document: Only one top level element is allowed.
This is the code i am using:
//create a file to marshal to
FileWriter writer = null;
writer = new FileWriter( destDirectory + "test.xml" );
Marshaller mr = new Marshaller( writer );
//For each claim no get the model and print out the XML
for ( Iterator i = claimNos.iterator(); i.hasNext(); )
{
String claimNo = (String)i.next();
PensionInfo pensionInfoModel = PensionInfo.retrieve( claimNo
); //marshal the info
mr.marshal( pensionInfoModel );
}
Does anyone have any ideas on how to loop through more then one
instance and get it to Marshal properly?? Thanks for any help!!
EC
type) at a time. Marshalling one class I can do. However when I want
to Marshal more then one instance i get this error in the XML
document: Only one top level element is allowed.
This is the code i am using:
//create a file to marshal to
FileWriter writer = null;
writer = new FileWriter( destDirectory + "test.xml" );
Marshaller mr = new Marshaller( writer );
//For each claim no get the model and print out the XML
for ( Iterator i = claimNos.iterator(); i.hasNext(); )
{
String claimNo = (String)i.next();
PensionInfo pensionInfoModel = PensionInfo.retrieve( claimNo
); //marshal the info
mr.marshal( pensionInfoModel );
}
Does anyone have any ideas on how to loop through more then one
instance and get it to Marshal properly?? Thanks for any help!!
EC