# Package net.sf.saxon.event

This package provides classes that feed SAX-like events from one tree to another. Some of these classes are associated with serializing the output of a stylesheet, but there are also classes for building a tree from a stream of events, for stripping whitespace, and so on.

The `Receiver` interface defines a class that accepts a stream of events, with one method defined for each kind of event. The events are modelled on the design of SAX, but adapted to the XPath data model and to the use of Saxon's NamePool. Attributes and namespaces are notified individually after the start of the relevant element. Many of the classes in this package are implementations of the `Receiver` interface.

The immediate output of node constructors in a query or stylesheet goes to a `Outputter`.When constructing the content of an element, a `ComplexContentOutputter` is used; when constructing the content of a node such as a text node or attribute, a `SequenceOutputter` is used instead.

The final destination of the push pipeline is sometimes a serializer, and sometimes a tree builder. The final serialization classes are subclasses of `Emitter`, but some of the serialization work (such as indentation or application of character maps) is done by other classes on the pipeline. These are generally constructed by extending the `ProxyReceiver` class.

The Emitter is an abstract implementation of the Receiver interface. As well as supporting the Receiver interface, it provides methods for controlling the destination of serialized output (a Writer or OutputStream) and for setting serialization properties (in a Properties object). In practice nearly all the implementations of Receiver are currently subclasses of Emitter, but this may change in the future.

The package includes emitters for the standard output methods xml, html, and text, and proxy emitters to allow a sequence of filters to be applied to the output.

,

The class `ContentHandlerProxy` allows events to be converted into standard SAX events and sent to a SAX2 `ContentHandler`. Similarly, the class `ProxyReceiver` acts as a `ContentHandler`, accepting SAX2 events and feeding them into a `Receiver` pipeline.

The class `Builder` is a `Receiver` that constructs a tree representation of the document in memory. There are two subclasses for Saxon's two native tree models. Other classes such as a `Stripper` and a `NamespaceReducer` are used to modify the document by adding filters to the pipeline.

Saxon's schema validator and serializer are both implemented using this push pipeline model. The classes that perform schema validation are part of package: `com.saxonica.ee.validate`, while the serialization classes are in `net.sf.saxon.serialize`.

- Interface Summary
  Interface | Description
  --- | ---
  CopyInformee<T> | A CopyInformee is an agent that receives extra information while a tree is being copied.
  FilterFactory | Factory class to create a ProxyReceiver which filters events on a push pipeline
  Receiver | Receiver: This interface represents a recipient of XML tree-walking (push) events.
  ReceiverWithOutputProperties | Marker interface attached to a `Outputter` that retains serialization properties (typically, a Receiver that forms part of the serialization pipeline).

- Class Summary
  Class | Description
  --- | ---
  Builder | The abstract Builder class is responsible for taking a stream of SAX events and constructing a Document tree.
  BuilderMonitor | A BuilderMonitor can be inserted into a pipeline immediately in front of a Builder.
  CheckSumFilter | A filter to go on a Receiver pipeline and calculate a checksum of the data passing through the pipeline.
  CloseNotifier | A receiver that performs specified actions when closed
  CommentStripper | The CommentStripper class is a filter that removes all comments and processing instructions.
  ComplexContentOutputter | This class is used for generating complex content, that is, the content of an element or document node.
  ContentHandlerProxy | A ContentHandlerProxy is a Receiver that converts events into the form expected by an underlying SAX2 ContentHandler.
  ContentHandlerProxy.ContentHandlerProxyTraceListener | Create a TraceListener that will collect information about the current location in the source document.
  ContentHandlerProxyLocator | Implementation of the SAX Locator interface, used to supply location information to the ContentHandler.
  DocumentValidator | DocumentValidator checks that a document is well-formed: specifically, that it contains a single element node child and no text node children.
  Event | An event is an object representing one of the events that can be passed to a receiver: for example, a startElement, endElement, characters, or comment event.
  Event.Append | Event representing an arbitrary item being sent to the event stream in composed form.
  Event.Comment | Event representing a comment node
  Event.EndDocument | Event representing end of document
  Event.EndElement | Event representing the end of an element
  Event.ProcessingInstruction | Event representing a processing instruction node
  Event.StartDocument | Event representing start of document
  Event.StartElement | Event representing the start of an element (including attributes or namespaces)
  Event.Text | Event representing a text node
  EventBuffer | An `EventBuffer` is a receiver of events that records the events in memory for subsequent replay.
  EventMonitor | An `EventMonitor` is a filter that passes all events down the pipeline unchanged, keeping a note of whether any data has passed through the filter.
  EventSource | An implementation of the JAXP Source class that supplies a document in the form of a stream of push events sent to a Receiver
  IDFilter | IDFilter is a ProxyReceiver that extracts the subtree of a document rooted at the element with a given ID value.
  IgnorableWhitespaceStripper | The IgnorableWhitespaceStripper removes whitespace text nodes belonging to elements whose schema-defined type defines element-only content
  LocationCopier | A Receiver that can be inserted into an event pipeline to copy location information.
  NamePoolConverter | This class is a filter that passes all Receiver events through unchanged, except that it changes namecodes to allow for the source and the destination using different NamePools.
  NamespaceDifferencer | `NamespaceDifferencer` is a `ProxyReceiver` responsible for removing duplicate namespace declarations.
  NamespaceReducer | `NamespaceReducer` is a `ProxyReceiver` responsible for removing duplicate namespace declarations.
  Outputter | Outputter: This interface represents a recipient of XML tree-walking (push) events.
  OutputterEvent | An outputter event is an object representing one of the events that can be passed to an `Outputter` : for example, a startElement, attribute, namespace endElement, characters, or comment event.
  OutputterEvent.Append | Event representing an arbitrary item being sent to the event stream in composed form.
  OutputterEvent.Attribute | Event representing an attribute node
  OutputterEvent.Comment | Event representing a comment node
  OutputterEvent.EndDocument | Event representing end of document
  OutputterEvent.EndElement | Event representing the end of an element
  OutputterEvent.Namespace | Event representing a namespace node
  OutputterEvent.ProcessingInstruction | Event representing a processing instruction node
  OutputterEvent.StartContent | Event representing the start of element content
  OutputterEvent.StartDocument | Event representing start of document
  OutputterEvent.StartElement | Event representing the start of an element (including attributes or namespaces)
  OutputterEvent.Text | Event representing a text node
  OutputterEventBuffer | An `EventBuffer` is a receiver of events that records the events in memory for subsequent replay.
  PathMaintainer | This class sits in a receiver (push) pipeline and maintains the current path.
  PIGrabber | The `PIGrabber` class is a `ProxyReceiver` that looks for `xml-stylesheet` processing instructions and tests whether they match specified criteria; for those that do, it creates a `Source` object referring to the relevant stylesheet
  PipelineConfiguration | A PipelineConfiguration sets options that apply to all the operations in a pipeline.
  ProxyOutputter |
  ProxyReceiver | A ProxyReceiver is an Receiver that filters data before passing it to another underlying Receiver.
  PushToReceiver |
  ReceiverOption | ReceiverOption defines a set of constants representing boolean flags, which can be used in calls to methods on the Receiver interface.
  ReceivingContentHandler | ReceivingContentHandler is a glue class that provides a standard SAX ContentHandler interface to a Saxon Receiver.
  ReceivingContentHandler.LocalLocator | An implementation of the Saxon `Location` interface that wraps the SAX Locator information.
  RegularSequenceChecker | A `RegularSequenceChecker` is a filter that can be inserted into a Receiver pipeline to check that the sequence of events passed in is a regular event sequence.
  RepairingContentHandler | A RepairingContentHandler is a SAX filter that can be placed on the input pipeline in front of a `ReceivingContentHandler` for use in cases where the events supplied by the XML parser are not guaranteed to satisfy all the consistency constraints.
  Sender | Sender is a helper class that sends events to a Receiver from any kind of Source object
  SequenceCollector | This receiver is used when writing a sequence of atomic values and nodes, that is, when xsl:variable is used with content and an "as" attribute.
  SequenceCopier | Copies a sequence, supplied as a SequenceIterator, to a push pipeline, represented by a SequenceReceiver
  SequenceNormalizer | Implement the "sequence normalization" logic as defined in the XSLT 3.0/XQuery 3.0 serialization spec.
  SequenceNormalizerWithItemSeparator | Implement the "sequence normalization" logic as defined in the XSLT 3.0/XQuery 3.0 serialization spec.
  SequenceNormalizerWithSpaceSeparator | Implement the "sequence normalization" logic as defined in the XSLT 3.0/XQuery 3.0 serialization spec, for the case where there is no item-separator.
  SequenceReceiver | SequenceReceiver: this extension of the Receiver interface is used when processing a sequence constructor.
  SequenceWriter | The `SequenceWriter` is used when writing a sequence of items, for example, when `xsl:variable` is used with content and an "as" attribute.
  SignificantItemDetector | This receiver is inserted into the output pipeline whenever on-empty or on-non-empty is used (XSLT 3.0).
  Sink | A Sink is a Receiver that discards all information passed to it
  SinkOutputter | An Outputter that swallows (discards) all input supplied to it
  StreamWriterToReceiver | This class implements the XmlStreamWriter interface, translating the events into Saxon Receiver events.
  Stripper | The RuleBasedStripper class performs whitespace stripping according to the rules of the xsl:strip-space and xsl:preserve-space instructions.
  Stripper.StripRuleTarget |
  TeeOutputter | TeeOutputter: a SequenceReceiver that duplicates received events to two different destinations
  TransformerReceiver | TransformerReceiver is similar in concept to the JAXP TransformerHandler, except that it implements Saxon's Receiver interface rather than the standard SAX2 interface.
  TreeReceiver | A TreeReceiver acts as a bridge between a SequenceReceiver, which can receive events for constructing any kind of sequence, and an ordinary Receiver, which only handles events relating to the building of trees.
  TypeCheckingFilter | A filter on the push pipeline that performs type checking, both of the item type and the cardinality.
  Valve | A Valve is a general-purpose component for use in a pipeline of receivers.
  WherePopulatedOutputter | This class acts as a filter on a push pipeline, allowing through only those items that are deemed non-empty according to the rules of the xsl:where-populated instruction.

- Enum Summary
  Enum | Description
  --- | ---
  RegularSequenceChecker.State |

- Exception Summary
  Exception | Description
  --- | ---
  CopyNamespaceSensitiveException | Exception indicating that an attempt was made to copy namespace-sensitive content without copying its associated namespaces
  NoOpenStartTagException | Exception indicating that an attribute or namespace node has been written when there is no open element to write it to