WsReadElement function (webservices.h)

Read an element producing a value of the specified WS_TYPE.


HRESULT WsReadElement(
  [in]           WS_XML_READER                *reader,
  [in]           const WS_ELEMENT_DESCRIPTION *elementDescription,
  [in]           WS_READ_OPTION               readOption,
  [in, optional] WS_HEAP                      *heap,
                 void                         *value,
  [in]           ULONG                        valueSize,
  [in, optional] WS_ERROR                     *error


[in] reader

The reader that is positioned on the XML to deserialize.

[in] elementDescription

A pointer to a description of how to deserialize the element.

[in] readOption

Whether the element is required, and how to allocate the value.
See WS_READ_OPTION for more information.

[in, optional] heap

The heap to store the deserialized values in.


The interpretation of this parameter depends on the WS_READ_OPTION.

[in] valueSize

The interpretation of this parameter depends on the WS_READ_OPTION.

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


This API will move to the next element, verify its name and namespace, and then and deserialize the content as a typed value.

If the API fails, the state of input reader becomes undefined. The only APIs that may be used on the reader if this occurs are WsSetInput and WsSetInputToBuffer to return the reader to a usable state, or WsFreeReader to free the reader.


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