Give this a try:

java.io.Reader myReader = ... //your Reader that contians xml input
org.exolab.castor.xml.Unmarshaller u = new Unmarshaller((Class)null);
//consider instantiating this at system-start-up.
Object myNewObject = u.unmarshal(myReader);

--Erik

      > -----Original Message-----
      > From: William Blencowe 
      > [mailto:[EMAIL PROTECTED] 
      > Sent: Thursday, October 30, 2003 8:25 AM
      > To: [EMAIL PROTECTED]
      > Subject: [castor-dev] XML Inheritance
      > 
      > 
      > Hello,
      > 
      >     My Software will be receiving many different(but 
      > similar) marshalled castor messages over a socket.  I 
      > have complete control of the xml
      > formats(schema) and can change them as necessary.  It 
      > was easy to marshal the message objects into the xml, 
      > but how do I unmarshal them????
      > 
      >     There's a separate object per message type, so I 
      > need a way to figure out which object.unmarshal to call 
      > on the receiving end.  Is there a 'best practice'  to 
      > determine which object.unmarshal to call?
      > 
      >     I came up with two methods, but they waste lots of time:
      > 
      >        1)  Attempt to validate each against the list of 
      > possible messages formats prior to the unmarshal
      > 
      >        2)  Look into each xml message package and try 
      > to determine which format. (kinda pre-parse)
      > 
      >     I'm hoping that there's a simple inheritance 
      > mechanism, every xml message inherites from a base 
      > which stores the full message type.  I could possible 
      > unmarshal on the base, determine the type, and then 
      > unmarshal the full message.
      > 
      >    Any ideas???
      > 
      > 
      >         -bill
      > 
      > ----------------------------------------------------------- 
      > If you wish to unsubscribe from this mailing, send mail 
      > to [EMAIL PROTECTED] with a subject of:
      >         unsubscribe castor-dev
      > 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to