### Saxon.Api

- BinaryResource
- CatalogCollection
- DirectoryCollection
- DocumentBuilder
- DomDestination
- DynamicContext
- DynamicError
- EmptyEnumerator<T>
- ErrorReporter
- ErrorReporterToStaticError
- ErrorReporterWrapper
- ExtensionFunction
- ExtensionFunctionCall
- ExtensionFunctionDefinition
- Feature<T>
- FeatureKeys
- HostLanguage
- ICollectionFinder
- IErrorReporter
- IInvalidityHandler
- IMessageListener
- IMessageListener2
- InvalidityHandlerWrapper
- IPredicate<in XdmItem>
- IQueryResolver
- IResource
- IResourceCollection
- IResourceFactory
- IResultDocumentHandler
- IXmlLocation
- JarCollection
- NamespaceConstant
- NullDestination
- Predicate<T>
- Predicates
- Processor
- QName
- RawDestination
- RecoveryPolicy
- Resource
- ResourceCollection
- SchemaManager
- SchemaResolver
- SchemaValidationMode
- SchemaValidator
- Serializer
- StandardCollectionFinder
- StandardLogger
- StaticContext
- StaticError
- Step<TInput, TResult>
- Steps
- TextWriterDestination
- TreeModel
- URIQueryParameters
- ValidationFailure
- WhitespacePolicy
- XdmAnyArrayType
- XdmAnyFunctionType
- XdmAnyItemType
- XdmAnyMapType
- XdmAnyNodeType
- XdmArray
- XdmAtomicType
- XdmAtomicValue
- XdmAxis
- XdmDestination
  - - TreeProtector
- XdmEmptySequence
- XdmExternalObjectValue
- XdmFunctionItem
- XdmItem
- XdmItemType
- XdmMap
- XdmNode
- XdmNodeKind
- XdmSequenceType
- XdmValue
- XmlDestination
- XmlProcessingError
- XmlResource
- XPathCompiler
- XPathExecutable
- XPathSelector
- XQueryCompiler
- XQueryEvaluator
- XQueryExecutable
- Xslt30Transformer
- XsltCompiler
- XsltExecutable
  - - ParameterDetails
- XsltPackage
- XsltTransformer

### Saxon.Api

# Class TextWriterDestination

public class TextWriterDestination
extends net.sf.saxon.s9api.AbstractDestination
implements XmlDestination

A `TextWriterDestination` is an implementation of `XmlDestination` that wraps an instance of `XmlWriter`.

The name `TextWriterDestination` is a misnomer; originally this class would only wrap an `XmlTextWriter`. It will now wrap any `XmlWriter`.

Note that when a `TextWriterDestination` is used to process the output of a stylesheet or query, the output format depends only on the way the underlying `XmlWriter` is configured; serialization parameters present in the stylesheet or query are ignored. The XSLT `disable-output-escaping` option is also ignored. If serialization is to be controlled from the stylesheet or query, use a `Serializer` as the `Destination`.

### Constructor Summary
TextWriterDestination (XmlWriter writer) Construct a `TextWriterDestination`

### Property Summary
bool | CloseAfterUse The `CloseAfterUse` property indicates whether the underlying `XmlWriter` is closed (by calling its `Close()` method) when Saxon has finished writing to it. The default value is true, in which case `Close()` is called. If the property is set to `false`, Saxon will refrain from calling the `Close()` method, and merely call `Flush()`, which can be useful if further output is to be written to the `XmlWriter` by the application.

### Method Summary
void | close() Close any resources associated with this destination. Note that this does not close any user-supplied OutputStream or Writer; those must be closed explicitly by the calling application.
net.sf.saxon.event.Receiver | GetReceiver(net.sf.saxon.event.PipelineConfiguration pipe, net.sf.saxon.serialize.SerializationProperties params1) Return a `Receiver`. Saxon calls this method to obtain a Java `Receiver`, to which it then sends a sequence of events representing the content of an XML document. The method is intended primarily for internal use, and may give poor diagnostics if used incorrectly.
net.sf.saxon.event.Receiver | getReceiver(net.sf.saxon.event.PipelineConfiguration pipe, net.sf.saxon.serialize.SerializationProperties value2) Return a `Receiver`. Saxon calls this method to obtain a Java `Receiver`, to which it then sends a sequence of events representing the content of an XML document. The method is intended primarily for internal use, and may give poor diagnostics if used incorrectly.
net.sf.saxon.s9api.Destination | GetUnderlyingDestination() The underlying `Destination` object in the Saxon implementation

## Constructor Detail

### TextWriterDestination

public TextWriterDestination(XmlWriter writer)

Construct a `TextWriterDestination`

Parameters:

`writer` - The `XmlWriter` that is to be notified of the events representing the XML document.

## Property Detail

### CloseAfterUse

public bool CloseAfterUse {get; set; }

The `CloseAfterUse` property indicates whether the underlying `XmlWriter` is closed (by calling its `Close()` method) when Saxon has finished writing to it. The default value is true, in which case `Close()` is called. If the property is set to `false`, Saxon will refrain from calling the `Close()` method, and merely call `Flush()`, which can be useful if further output is to be written to the `XmlWriter` by the application.

## Method Detail

### close

public override void close()

Close any resources associated with this destination. Note that this does not close any user-supplied OutputStream or Writer; those must be closed explicitly by the calling application.

### GetReceiver

public net.sf.saxon.event.Receiver GetReceiver(net.sf.saxon.event.PipelineConfiguration pipe,
net.sf.saxon.serialize.SerializationProperties params1)

Return a `Receiver`. Saxon calls this method to obtain a Java `Receiver`, to which it then sends a sequence of events representing the content of an XML document. The method is intended primarily for internal use, and may give poor diagnostics if used incorrectly.

Parameters:

`pipe` - The Saxon configuration as a `JPipelineConfiguration`. This is supplied so that the destination can use information from the configuration (for example, a reference to the name pool) to construct or configure the returned `Receiver`.
`params1`

Returns:

The receiver

### getReceiver

public override net.sf.saxon.event.Receiver getReceiver(net.sf.saxon.event.PipelineConfiguration pipe,
net.sf.saxon.serialize.SerializationProperties value2)

Return a `Receiver`. Saxon calls this method to obtain a Java `Receiver`, to which it then sends a sequence of events representing the content of an XML document. The method is intended primarily for internal use, and may give poor diagnostics if used incorrectly.

Parameters:

`pipe` - The Saxon configuration as a `JPipelineConfiguration`. This is supplied so that the destination can use information from the configuration (for example, a reference to the name pool) to construct or configure the returned `Receiver`.
`value2` - Serialization parameters known to the caller of the method; typically, output properties defined in a stylesheet or query. These will mainly be of interest if the destination is performing serialization, but soem properties (such as `item-separator`) are also used in other situations.

Returns:

The receiver

### GetUnderlyingDestination

public net.sf.saxon.s9api.Destination GetUnderlyingDestination()

The underlying `Destination` object in the Saxon implementation

This property provides access to internal methods in the Saxon engine that are not specifically exposed in the .NET API. In general these methods should be considered to be less stable than the classes in the Saxon.Api namespace.

The internal methods follow Java naming conventions rather than .NET conventions.

Information about the returned net.sf.saxon.Configuration object (and the objects it provides access to) is included in the Saxon JavaDoc docmentation.

Returns:

returns the underlying Destination object