Class StreamWriterToReceiver

java.lang.Object
net.sf.saxon.event.StreamWriterToReceiver
All Implemented Interfaces:
XMLStreamWriter
Direct Known Subclasses:
BuildingStreamWriterImpl

public class StreamWriterToReceiver extends Object implements XMLStreamWriter
This class implements the XmlStreamWriter interface, translating the events into Saxon Receiver events. The Receiver can be anything: a serializer, a schema validator, a tree builder.

This class does not itself perform "namespace repairing" as defined in the interface Javadoc (also referred to as "prefix defaulting" in the StaX JSR specification). In normal use, however, the events emitted by this class are piped into a NamespaceReducer which performs a function very similar to namespace repairing; specifically, it ensures that when elements and attribute are generated with a given namespace URI and local name, then namespace declarations are generated automatically without any explicit need to call the writeNamespace(String, String) method.

The class will check all names, URIs, and character content for conformance against XML well-formedness rules unless the checkValues option is set to false.

The implementation of this class is influenced not only by the Javadoc documentation of the XMLStreamWriter interface (which is woefully inadequate), but also by the helpful but unofficial interpretation of the spec to be found at http://veithen.github.io/2009/11/01/understanding-stax.html

Provided that the sequence of events sent to this class is legitimate, the events sent to the supplied Receiver should constitute a regular sequence as defined in the documentation of class RegularSequenceChecker.

Since:
9.3. Rewritten May 2015 to fix bug 2357. Further modified in 9.7.0.2 in light of the discussion of bug 2398, and the interpretation of the spec cited above.