Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsSetOutput function

Sets the encoding and output callbacks for the writer. The callbacks are used to provides buffers to the writer and to perform asynchronous i/o.


  _In_     WS_XML_WRITER*                writer,
  _In_opt_ const WS_XML_WRITER_ENCODING* encoding,
  _In_opt_ const WS_XML_WRITER_OUTPUT*   output,
           const WS_XML_WRITER_PROPERTY* properties,
  _In_     ULONG                         propertyCount,
  _In_opt_ WS_ERROR*                     error


writer [in]

The writer for which the output will be set.

encoding [in, optional]

The encoding describes the format of the input bytes. This should be one of WS_XML_WRITER_TEXT_ENCODING, WS_XML_WRITER_BINARY_ENCODING or WS_XML_WRITER_MTOM_ENCODING.

output [in, optional]

Specifies where the writer should place its data.


An array of optional properties of the writer. See WS_XML_WRITER_PROPERTY.

propertyCount [in]

The number of properties.

error [in, optional]

Specifies where additional error information should be stored if the function fails.

Return value

This function can return one of these values.

Return codeDescription

One or more arguments are invalid.



When WsSetOutput is used on the writer, the writer will function in a forward only manner and the functions WsGetWriterPosition, WsSetWriterPosition and WsMoveWriter cannot be used.

If encoding is NULL, then WS_XML_WRITER_OUTPUT is ignored and the writer is set up so that any attempt to write to it will fail.

If encoding is not NULL, then WS_XML_WRITER_OUTPUT must be non-NULL as well.

If WS_XML_WRITER_OUTPUT is WS_XML_WRITER_BUFFER_OUTPUT then the writer will buffer the generated bytes of the document. Use WsGetWriterProperty with WS_XML_WRITER_PROPERTY_BUFFERS or WS_XML_WRITER_PROPERTY_BYTES to obtain these bytes. In this mode WsFlushWriter has no effect.

If WS_XML_WRITER_OUTPUT is WS_XML_WRITER_STREAM_OUTPUT then the writer will pass the generated bytes of the document to the specified WS_WRITE_CALLBACK during calls to WsFlushWriter.

The writer will be initialized to use the properties specified in WsCreateWriter. Any properties specified to WsSetOutput will override those properties.

See WsCreateWriter for the default values of the properties of the writer.


Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]









Community Additions

© 2017 Microsoft