WsFindAttribute function (webservices.h)

Searches the attributes of the current element for an attribute with the specified name and namespace and returns its index which may be passed to WsReadStartAttribute.

Syntax

HRESULT WsFindAttribute(
  [in]           WS_XML_READER       *reader,
  [in]           const WS_XML_STRING *localName,
  [in]           const WS_XML_STRING *ns,
  [in]           BOOL                required,
  [out]          ULONG               *attributeIndex,
  [in, optional] WS_ERROR            *error
);

Parameters

[in] reader

The reader on which to find the attribute.

[in] localName

The local name of the attribute to search for.

[in] ns

The namespace of the attribute to search for.

[in] required

If required is TRUE and the attribute is not found, the function will return WS_E_INVALID_FORMAT. (See Windows Web Services Return Values.) if required is FALSE and the attribute is not found, the function will return S_FALSE.

[out] attributeIndex

If the attribute is found, then the index of the attribute, is returned here. This index can then be passed to WsReadStartAttribute.

[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.

Remarks

If the reader is not positioned on a start element then it will return WS_E_INVALID_OPERATION. (See Windows Web Services Return Values.)

The index returned does not necessarily correspond to the position of the attribute as it appeared in the document. It identifies the index of the matching attribute in the array of attributes of the WS_XML_ELEMENT_NODE. The order of the attributes in this array may differ from the order in which the attributes appeared in the document.

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