Hi Kent, > From: Kent Dahl [mailto:kentda / stud.ntnu.no] > Sent: Monday, September 17, 2001 11:23 PM > Michael Neumann wrote: > > Try SOAP or XML-RPC for marshalling Ruby objects in a language-independent > > format (requires SOAP4R or xmlrpc4r to be installed): # MN: Thank you for introducing SOAP4R, too. > I looked at these some months ago, but I had a new look now on SOAP. > (xmlrpc4r wouldn't install properly, I'll try again later.) xmlrpc4r is much easier to install and use than SOAP4R. Try it. > Nonetheless, it (SOAP) does not seem adequate for my needs: > 1) Language/implementation specific metadata in datafile (still lots of > type attribs) What is datafile here? > 2) I can't seem to get referential integrity. See below. > 3) The XML is less human-readable that I'd wish, mostly due to 1) Definitely. > Seeing as point 2 is the show-stopper (for me), I'll elaborate. > > <CODE> > dad = Person.new > son = Person.new > son.father = dad > people = [ dad, son ] > aString = SOAP::Marshal.marshal( people ) > xdad, xson = SOAP::Marshal.unmarshal( aString ) > </CODE> > > Then > a) xdad.id != xson.father.id Try; a = []; p a.id b = Marshal.load( Marshal.dump( a )); p b.id Original object and unmarshalled object is not the same thing in Ruby. I think it reasonable. > b) xdad.type != dad.type This might helps you; class Person; include SOAP::Marshallable attr_accessor :father end > So then I wonder, does SOAP, XMLRPC, XMarshal or any other XML based > method of marshalling maintain referential integrity? (If that is the > right word for it) As Tobin states in [ruby-talk:21297], SOAP allow you to multi-ref serialization/deserialization. But SOAP4R supports only multi-ref deserialization now (See 'Restrictions' in http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/RELEASE_en.html) Multi-ref serialization related topic is under descussion in ruby-dev (and suspended now.) I will implement it someday. Anyway, why don't you try to build your own version? Welcome to Ruby object-XML serialization world. Regards, // NaHi