You can. The following example of how to manipulate the generated HTML, was
documented somewhere in the ND 3.1 Docs. 

=========================================================================
Make changes to the generated HTML after the fact. This requires redirection
of the output stream to an internal buffer before the display() begins.
Then, once this event is triggered, you can obtain the generated HTML, make
modifications to it (e.g. by replacing some place holder token with the
"latest news" String) and write out the final results. Here is the framework
for this technique: 

  protected int 
      onBeforeDisplayEvent ( 
         ) 
   { 
      // Save the original output stream 
      _origStream = CSpider.getOutputStream (); 

      // Construct a byte array output stream and create a 
      // CSpStringOutputStream out of it 
      _myArrayStream = new ByteArrayOutputStream (10000); 
      _myStream = new CSpStringOutputStream (_myArrayStream); 

      // Set our temporary string output stream to be used 
      // when constructing the HTML ("stealing" the HTML page) 
      CSpider.setOutputStream (_myStream); 

      return (PROCEED_WITH_BUILTIN_HANDLING); 
   } 

   protected int 
      onBeforeHtmlOutputEvent ( 
         ) 
   { 
      try 
      { 
         // Flush everything so that our byte array will get loaded 
         // with the HTML 
         CSpHtml.flush (_myStream); 

         // Convert the byteArray into a String 
         String   htmlPage = _myArrayStream.toString (); 

         // Restore the original output stream 
         CSpider.setOutputStream (_origStream); 

         // Make some late changes to the HTML 
         String modifiedHtmlPage = 
                 CSpUtil.replaceSubstring (htmlPage, 
                                           ............); 
         // Write the modified HTML out 
         CSpHtml.sendRawDataItem (_origStream, modifiedHtmlPage); 
      } 
      catch (Exception  ex) 
      { 
         // Shouldn't occur 
      } 

      return (PROCEED_WITH_BUILTIN_HANDLING); 
   } 

   protected CSpStringOutputStream _origStream    = null; 
   protected ByteArrayOutputStream _myArrayStream = null; 
   protected CSpStringOutputStream _myStream      = null; 
 ==========================================================
 

Aby
   

> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, May 21, 1999 4:42 PM
> To:   [EMAIL PROTECTED]
> Subject:      [ND] Getting a page's HTML without displaying the page to
> the browser
> 
> Hi,
> 
> I want to "load" a page and get its HTML to send in an email message.  I
> want to do this behind the scenes without sending the page to the browser.
> 
> Can this be done?  If so, how?
> 
> Thanks
> 
> _________________________________________________________________________
> 
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
> 
> For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to