Re: [Simple-support] Deserialize a list of objects from one XML
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2009-03-15 22:41:48
|
Hi, I am afraid this is a StAX problem. So it all depends on the StAX implementation you use. Some StAX parsers will read the whole file and find that it is not valid, others may not. Simple does not deal with the stream directly. You can write to a single file. But reading multiple XML serializations from a single file will depend on how stax does it. Niall --- On Sun, 3/15/09, Timo Rumland <cr...@ol...> wrote: > From: Timo Rumland <cr...@ol...> > Subject: [Simple-support] Deserialize a list of objects from one XML > To: sim...@li... > Date: Sunday, March 15, 2009, 3:36 PM > Hello, > > > In answer to your question yes, you can stream many > objects to one > > file. Also, simple should be much more memory > efficient than XStream > > at just about everything. > > > > Niall > > Niall, you wrote these lines on June 3rd (2008), but I > could not find > another question/answer related to this topic. > > Let's say, several objects, serialized to XML, are in > one file (so > there is more than one xml root in one file). Is it > possible to > deserialize it to a list of objects? I'm missing a > method with a > signature like > > public < T > List< T > > serializer.read(Class< ? extends T > type, String xml > ); > > (assuming the types of the objects in the file are all the > same.) > > Is this possible out-of-the-box with simpleXML? Or do I > have to > preprocess and parse the XML code and then call the > serializer.read > method subsequently? > > > Thanks a lot > > > Best regards, > Timo > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex > Builder(TM) are > powering Web 2.0 with engaging, cross-platform > capabilities. Quickly and > easily build your RIAs with Flex Builder, the > Eclipse(TM)based development > software that enables intelligent coding and step-through > debugging. > Download the free 60 day trial. > http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |