cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: DOMStreamer
Date Tue, 24 Jul 2001 17:34:39 GMT
Dims,

On Tue, 24 Jul 2001 03:43:44 -0700 (PDT), Davanum Srinivas <dims@yahoo.com> wrote:

> Ovidiu,
> 
> What does this file have? What format is it in?
> 
> Thanks,
> dims
> 
> --- Ovidiu Predescu <ovidiu@cup.hp.com> wrote:
> 
> 
> > ATTACHMENT part 1 application/octet-stream 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org

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 <ovidiu@cup.hp.com>
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" <tcurdt@dff.st> 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 <ovidiu@cup.hp.com>
    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 <ovidiu@cup.hp.com>
 */
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: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message