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.

WsFindAttribute function

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.


HRESULT WINAPI  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_opt_ WS_ERROR*            error


reader [in]

The reader on which to find the attribute.

localName [in]

The local name of the attribute to search for.

ns [in]

The namespace of the attribute to search for.

required [in]

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.

attributeIndex [out]

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

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

The input data was not in the expected format or did not have the expected value.



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.


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