Share via


MoveToAttributeByName (Compact 2013)

3/26/2014

This interface moves the reader to the attribute that has the specified name.

Syntax

HRESULT MoveToAttributeByName (
  const WCHAR* pwszLocalName, 
  const WCHAR* pwszNamespaceUri
);

Arguments

  • pwszLocalName
    [in] The local name of the attribute
  • pwszNamespaceUri
    [in] The namespace of the attribute. If pwszNamespaceUri is NULL, the search will match only attributes that have no namespaces.

Return Value

This interface returns S_OK if no error is generated. If the attribute is not found, this method returns S_FALSE and leaves the position of the reader unchanged.

Remarks

This method is implemented as a convenience. You can use this method if you must retrieve the value of one or two attributes, and you are not very concerned about performance.

Using this method frequently can decrease performance. The typical programming pattern is to iterate through all attributes on an element and save all values in a data construct that is under your control. Calling this method does not let the parser to return all attributes in the most efficient manner.

After this method is called, the attributes collection on the element is still available. The application can then call other methods to move the reader within the attributes collection.

See Also

Reference

IXmlReader Methods
IXmlReader Properties
Error Codes