WsWriteAttribute function (webservices.h)

Write a typed value as an XML attribute.

Syntax

HRESULT WsWriteAttribute(
  [in]           WS_XML_WRITER                  *writer,
  [in]           const WS_ATTRIBUTE_DESCRIPTION *attributeDescription,
  [in]           WS_WRITE_OPTION                writeOption,
                 const void                     *value,
  [in]           ULONG                          valueSize,
  [in, optional] WS_ERROR                       *error
);

Parameters

[in] writer

The writer to write the attribute to.

[in] attributeDescription

A pointer to a description of how to serialize the attribute.

[in] writeOption

Information about how the value is allocated. See WS_WRITE_OPTION for more information.

value

A pointer to the value to serialize.

[in] valueSize

The size of the value being serialized, in bytes.

If the value is NULL, then the size should be 0.

[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
WS_E_INVALID_FORMAT
The input data was not in the expected format or did not have the expected value.
E_INVALIDARG
One or more arguments are invalid.
E_OUTOFMEMORY
Ran out of memory.

Remarks

This API writes the start attribute, attribute value, and end attribute.

If the API fails, the state of input writer becomes undefined. The only APIs that may be used on the writer if this occurs are WsSetOutput and WsSetOutputToBuffer to return the writer to a usable state, or WsFreeWriter to free the writer.

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