Not sure whether this is the reason for Mark, but I'm doing something similar and had problems with firewalls when using sockets, whereas an ObjectStream can easily be returned from a servlet.
-----Original Message----- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: 17 May 2005 20:11 To: [email protected] Subject: Re: [castor-user] a sequence of objects can be serialized but not deserialized Why not connect thru TCP socket and parse the contents? Yes/No? Martin- ----- Original Message ----- From: "Mark Chamness" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, May 17, 2005 1:09 PM Subject: RE: [castor-user] a sequence of objects can be serialized but not deserialized > Hi, > Castor appears to require a root element to unmarshall objects. How would > it handle a continuous stream of objects over a network? > > By the way, is the website down? http://www.castor.org/ > > -mark > > -----Original Message----- > From: Mark Chamness [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 12, 2005 9:11 AM > To: [email protected] > Subject: [castor-user] a sequence of objects can be serialized but not > deserialized > > While sequence of objects can be serialized to a stream, they can't be > deserialized. The motivation for this comes from experience > with java serialization: > oos.writeInt(12345); > oos.writeObject("Today"); > oos.writeObject(new Date()); > > and then... > > int i = ois.readInt(); > String today = (String) ois.readObject(); > Date date = (Date) ois.readObject(); > > The error message for the following test case is: > Parsing Error : The markup in the document following the root element must > be well-formed. > > public void testMarshalMultipleObjects() throws Exception > { > TestObject testObject1 = new TestObject(); > testObject1.testString = "test one"; > TestObject testObject2 = new TestObject(); > testObject2.testString = "test two"; > StringWriter stringWriter = new StringWriter(); > Marshaller marshaller = new Marshaller(stringWriter); > marshaller.setSupressXMLDeclaration(true); //doesn't matter > marshaller.marshal(testObject1); > marshaller.marshal(testObject2); > StringReader stringReader = new StringReader(stringWriter.toString()); > Unmarshaller unmarshaller = new Unmarshaller(TestObject.class); > TestObject newTestObject1 = (TestObject) > unmarshaller.unmarshal(stringReader);//fails > TestObject newTestObject2 = (TestObject) > unmarshaller.unmarshal(stringReader); > Assert.assertEquals(testObject1.testString, newTestObject1.testString); > Assert.assertEquals(testObject2.testString, newTestObject2.testString); > } > > > public class TestObject > { > public String testString; > > public TestObject() > { > } > > public String getTestString() > { > return testString; > } > > public void setTestString(String testString) > { > this.testString = testString; > } > } > > > > > -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 17/05/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 17/05/2005

