Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Using Castor to Marshal a Java Class Properly

Reply
Thread Tools

Using Castor to Marshal a Java Class Properly

 
 
BuddahBelly
Guest
Posts: n/a
 
      02-24-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
marshal.dumps quadratic growth and marshal.dump not allowingfile-like objects bkustel@gmail.com Python 10 06-18-2008 12:52 PM
Python 2.4 does not marshal infinity floating point properly under Win32 Pierre Rouleau Python 2 11-30-2006 08:29 PM
[Castor]How to install Castor properly? Sam Hwang Java 0 04-26-2005 08:54 AM
Castor Marshal Xsl ado9868@___SSSPPPAAAMMM___katamail.com XML 0 03-15-2005 02:19 PM
Ruby 1.8 and Marshal.load/Marshal.dump Michael Davis Ruby 0 10-10-2003 10:15 PM



Advertisments