org.brownell.xml.pipeline
Class DomProducer

java.lang.Object
  |
  +--org.brownell.xml.pipeline.EventProducer
        |
        +--org.brownell.xml.pipeline.DomProducer

public class DomProducer
extends EventProducer

A SAX event source generated from a DOM node, normally a document. This producer can send multiple DOM nodes down an event pipeline after it has been established.

Note that if you want to turn a DOM tree into XML text, you should as a rule send output first through a filter to restore XML namespace syntax. With DOM, it is highly likely that such information will be discarded at some point in processing, and printing XML text often requires that elements should use and declare prefixes.

Version:
$Date: 2000/02/17 19:09:46 $
Author:
David Brownell
See Also:
NSFilter

Constructor Summary
DomProducer(org.w3c.dom.Node start)
          Produces a series of events corresponding to the appropriate traversal of the specified DOM node.
 
Method Summary
 void parseDocument(InputSource source)
          Not supported for this kind of event producer; always throws an exception.
 void parseDocument(org.w3c.dom.Node source)
          Start firing events to the next stage in the pipeline, returning when the events for the specified node are all reported.
 void produce(EventConsumer out)
          Configures the event producer to send events to the specified event consumer, and invokes parseDocument() with the initial input source.
 
Methods inherited from class org.brownell.xml.pipeline.EventProducer
getFeature, setEntityResolver, setErrorHandler, setFeature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomProducer

public DomProducer(org.w3c.dom.Node start)
Produces a series of events corresponding to the appropriate traversal of the specified DOM node. If the node isn't a document, startDocument and endDocument calls won't be made.
Method Detail

parseDocument

public void parseDocument(InputSource source)
                   throws SAXException,
                          java.io.IOException
Not supported for this kind of event producer; always throws an exception.
Overrides:
parseDocument in class EventProducer

produce

public void produce(EventConsumer out)
             throws SAXException
Description copied from class: EventProducer
Configures the event producer to send events to the specified event consumer, and invokes parseDocument() with the initial input source. After this returns, the producer is still configured to use that consumer (as when this method was called -- subsequent changes are ignored) and parseDocument may be invoked to send parsing events for additional XML documents.

Certain kinds of event filters are recognized, and can be optimized out by setting appropriate parser options. NSFilter is one such filter; if it is at the front of a pipeline, a producer wrapping a SAX parser may be able to remove it and improve overall performance by requesting that parsers not discard such information, rather than attempting a costly (and potentially error prone) reconstruction.

Overrides:
produce in class EventProducer
Tags copied from class: EventProducer
See Also:
PipelineFactory

parseDocument

public void parseDocument(org.w3c.dom.Node source)
                   throws SAXException,
                          java.io.IOException
Start firing events to the next stage in the pipeline, returning when the events for the specified node are all reported. If the node isn't a document, then startDocument and endDocument won't be invoked.