You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by ol...@sk-koeln.de on 2000/10/04 11:56:18 UTC

Antwort: Re: Passing DOM to EJB



Reading the xml doc from a file is not the choice for the project in question. I
      have tried to serialize the the DOM and pass it as a string or a byte
      array. Deserializig in the ejb doesn't work because of different serial
      numbers (class ids). I'm using the same jdk and the same xerces package on
      both sides.



Regards

  Oliver Bruening








      "Jeffrey Rodriguez" <je...@hotmail.com> schrieb am 29.09.2000
      18:45:49:

      > Hi Oliver,
      > You could pass a DOM object if you serialize it, but why would you
      > do that, passing a DOM object?
      >
      > A better way in my opinion would be to pass the XML instance document
      > through a stream ( you could compress/decompress the stream).
      >
      > If you just trying to get messages across you EJB would it be better
      > just to use the SAX parser instead of the DOM parser? Do you really
      > need random access to your instance document?
      >
      > If you still want to serialize and pass the DOM something like this
      > may work:
      >
      > Serializing it:
      >
      > public void serializeDOM( Document doc, String nameSerializedFile ){
      >         try {
      >             ObjectOutputStream out               =
      >                               new ObjectOutputStream( new
      FileOutputStream(
      > nameSerializedFile ) );
      >             out.writeObject(doc);
      >             out.close();
      >
      >         } catch ( Exception ex ) {
      >             ex.printStackTrace();
      >         }
      >     }
      >
      >
      > Deserializing it:
      >
      > /  * DeSerializes Java DOM Object
      >      *
      >      * @param nameSerializeFile
      >      * @return
      >      */
      >     public DocumentImpl deserializeDOM( String nameSerializedFile ){
      >         ObjectInputStream in   = null;
      >         DocumentImpl      doc  = null;
      >         try {
      >
      >             FileInputStream fileIn = new FileInputStream(
      nameSerializedFile
      > );
      >             in                     = new ObjectInputStream(fileIn);
      >             doc                    = (DocumentImpl)
      > in.readObject();//Deserialize object
      >         } catch ( Exception ex ) {
      >             ex.printStackTrace();
      >         }
      >         return doc;
      >     }
      >
      >
      >
      > Hope this helps,
      >
      >                  Jeffrey Rodriguez
      >                  IBM Silicon Valley
      >                  XML Development
      >
      >
      > >From: oliver.bruening@sk-koeln.de
      > >Reply-To: xerces-j-dev@xml.apache.org
      > >To: xerces-j-dev@xml.apache.org
      > >Subject: Passing DOM to EJB
      > >Date: Fri, 29 Sep 2000 09:04:16 +0100
      > >
      > >
      > >
      > >How can I pass an Xerces DOM object to an EJB ? I'm using the Inprise
      > >Application Server.
      > >
      > >Best regards
      > >   Oliver Bruening
      > >
      > >
      > >
      > >______________________________________________________________________
      > >
      > >
      > >    Da E-Mails leicht unter fremdem Namen erstellt oder manipuliert
      werden
      > >    koennen, muessen wir zu Ihrem und unserem Schutz die rechtliche
      > >    Verbindlichkeit der vorstehenden Erklaerungen ausschliessen. Die
      fuer
      > >die
      > >    Stadtsparkasse Koeln geltenden Regeln ueber die Verbindlichkeit von
      > >    rechtsgeschaeftlichen Erklaerungen mit verpflichtendem Inhalt
      bleiben
      > >    unberuehrt.
      > >
      > >
      > >
      > >
      > >---------------------------------------------------------------------
      > >To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
      > >For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
      > >
      >
      >
      _________________________________________________________________________
      > Get Your Private, Free E-mail from MSN Hotmail at
      http://www.hotmail.com.
      >
      > Share information about yourself, create your own public profile at
      > http://profiles.msn.com.
      >
      >
      > ---------------------------------------------------------------------
      > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
      > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
      >



______________________________________________________________________


   Da E-Mails leicht unter fremdem Namen erstellt oder manipuliert werden
   koennen, muessen wir zu Ihrem und unserem Schutz die rechtliche
   Verbindlichkeit der vorstehenden Erklaerungen ausschliessen. Die fuer die
   Stadtsparkasse Koeln geltenden Regeln ueber die Verbindlichkeit von
   rechtsgeschaeftlichen Erklaerungen mit verpflichtendem Inhalt bleiben
   unberuehrt.