-----Original Message-----
From: Rochana Attale [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 08, 2004 2:38 PM
To: [EMAIL PROTECTED]
Subject: [castor-user] Why aren't objects such as Vectors, ArrayLists not Marshalled?Hi,Here is my code:========================================import java.io.Serializable;
import java.util.*;public class TestObj implements Serializable {
private Vector list;public TestObj(Vector v) {
list = v;
}
}========================================
import java.io.*;
import java.util.*;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.*;public class test {
public static void main(String args[]) {
// Create a new TestObj
Vector v = new Vector();
v.add("Element 1");
v.add("Element 2");
TestObj test = new TestObj(v);
// Create a File to marshal to
try {
FileWriter writer = new FileWriter(new File("D:\\test.xml"));Marshaller.marshal(test, writer);
}
catch (MarshalException ex) {
ex.printStackTrace();
}
catch (ValidationException ex) {
ex.printStackTrace();
}
catch (IOException ex) {
ex.printStackTrace();
}}
}
My problem is that "test.xml" ends up looking like this without the Vector:<?xml version="1.0" encoding="UTF-8"?>
<test-obj/>
But if I marshalled the vector object by saying "Marshaller.marshal(v, writer);" the Vector is properly Marshalled.What am I doing wrong?Thanks in advance,Rochana
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
