I can see our unit tests have a collection encoding example:

List<TestObject> dataObjects = new ArrayList<TestObject>();

dataObjects.add(new TestObject("George", 5, true));
dataObjects.add(new TestObject("Mary", 28, false));
dataObjects.add(new TestObject("Joe", 31, true));

String xml = new XMLEncoder().encode("EncodedTestList", dataObjects);

On a side note, I am not a big fan of our XML coding implementation. It is DOM based and is not very scaleable. I started writing an XStream-based replacement in sandbox:

* 
http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-serialization/?pathrev=814869
* http://markmail.org/message/ljngasncx6jur6ud

But then my own itch to solve it disappeared, so that was put on hold. IIRC it is usable for most object subgraphs, but not optimized for all scenarios.

Andrus

On Jul 5, 2010, at 9:44 AM, Gary Jarrel wrote:
Hi All

Am I able to use the XMLEncoder to serialize a list of data objects. I
can see the XMLDecoder has a decodeList method, however the XMLEncoder
does not appear to have a public encodeList method?

Thank you

Gary


Reply via email to