WsWriteXmlBufferToBytes function (webservices.h)

Uses a writer to convert a WS_XML_BUFFER to an encoded set of bytes.

Syntax

HRESULT WsWriteXmlBufferToBytes(
  [in]           WS_XML_WRITER                *writer,
  [in]           WS_XML_BUFFER                *xmlBuffer,
  [in, optional] const WS_XML_WRITER_ENCODING *encoding,
                 const WS_XML_WRITER_PROPERTY *properties,
  [in]           ULONG                        propertyCount,
  [in]           WS_HEAP                      *heap,
                 void                         **bytes,
  [out]          ULONG                        *byteCount,
  [in, optional] WS_ERROR                     *error
);

Parameters

[in] writer

The writer to use to generate the encoded bytes.

[in] xmlBuffer

The XML buffer to write.

[in, optional] encoding

The encoding to use when generating the bytes. If NULL, the bytes will be encoded in utf8.

properties

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

[in] propertyCount

The number of properties.

[in] heap

The heap from which to allocate the bytes.

bytes

The generated bytes are returned here.

[out] byteCount

The number of generated bytes are returned here.

[in, optional] error

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

Return value

This function can return one of these values.

Return code Description
E_INVALIDARG
One or more arguments are invalid.
WS_E_INVALID_OPERATION
The operation is not allowed due to the current state of the object.
WS_E_QUOTA_EXCEEDED
A quota was exceeded.

Remarks

The function will generate the entire contents of the WS_XML_BUFFER as a linear set of bytes allocated from the specified heap in the encoding specified.

The writer will be left in an undefined state after calling this function. However, WsWriteXmlBufferToBytes may be used again with such a writer. Otherwise, WsSetOutput or WsSetOutputToBuffer should be used to bring the writer back to a known state, or the writer should be freed using WsFreeWriter.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll