Dims,

On Tue, 24 Jul 2001 03:43:44 -0700 (PDT), Davanum Srinivas <[EMAIL PROTECTED]> wrote:

> Ovidiu,
> 
> What does this file have? What format is it in?
> 
> Thanks,
> dims
> 
> --- Ovidiu Predescu <[EMAIL PROTECTED]> wrote:
> 
> 
> > ATTACHMENT part 1 application/octet-stream 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]

Somehow it looks like the mailing list software used by cocoon-dev
(ezmlm) doesn't like emails with attachments sent by my mailer (a home
brewed combination of exmh and emacs on Linux). I apologize for these
inconveniences, I'll try to figure out what's wrong. Here is the
message again, with the attachments inline:

Regards,
-- 
Ovidiu Predescu <[EMAIL PROTECTED]>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://sourceforge.net/users/ovidiu/ (my SourceForge page)
http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)


On Mon, 23 Jul 2001 23:45:08 +0200, "Torsten Curdt" <[EMAIL PROTECTED]> wrote:

> I have a DocumentFragment supposebly looking
> like this:
> 
> <one>
>   <two/>
> </one>
> 
> Now I try to create SAX events from it:
> 
>   DOMStreamer streamer = new DOMStreamer(handler);
>   streamer.stream(fragment);
> 
> Unfortunately this is also fireing the following
> events:
> 
> [setDocumentLocator] 
> [startDocument]
> [endDocument]
> 
> Why is that so? Anyone a clue?

I've created an EmbeddedXMLPipe that removes the events you mention. I
use it like this:

  public void toSAX(ContentHandler handler)
    throws SAXException
  {
    try {
      EmbeddedXMLPipe newHandler = new EmbeddedXMLPipe();
      newHandler.setContentHandler(handler);
      parser.setContentHandler(newHandler);
      InputSource source = getInputSource();
      parser.parse(source);
    catch (IOException ex) {
      throw new SAXException(ex);
    }
  }

I have this class in src/org/apache/cocoon/xml/.



/*
    EmbeddedXMLPipe.java

    Author: Ovidiu Predescu <[EMAIL PROTECTED]>
    Date: July 11, 2001

 */

package org.apache.cocoon.xml;

import org.xml.sax.SAXException;

/**
 * This class implements a ContentHandler for embedding a full SAX
 * event stream into an existing stream of SAX events. An instance of
 * this class will pass unmodified all the SAX events to the linked
 * ContentHandler, but will ignore the startDocument and endDocument
 * events.
 *
 * @author Ovidiu Predescu <[EMAIL PROTECTED]>
 */
public class EmbeddedXMLPipe extends AbstractXMLPipe
{
  /**
   * Ignore the <code>startDocument</code> event: this method does nothing.
   *
   * @exception SAXException if an error occurs
   */
  public void startDocument()
    throws SAXException
  {
  }

  /**
   * Ignore the <code>endDocument</code> event: this method does nothing.
   *
   * @exception SAXException if an error occurs
   */
  public void endDocument()
    throws SAXException
  {
  }
}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to