다음을 통해 공유


MoveToAttributeByName

 

Moves the reader to the attribute with the specified name.

Syntax

  
HRESULT MoveToAttributeByName ([in] const WCHAR * pwszLocalName, [in] const WCHAR * pwszNamespaceUri);  

Arguments

pwszLocalName
The local name of the attribute.

pwszNamespaceUri
The namespace of the attribute. If pwszNamespaceUri is NULL, the search will match only attributes with no namespaces.

Return Value

Returns S_OK if no error is generated. Returns E_PENDING if the data is unavailable, and the stream is paused. 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 have to get the value of one or two attributes, and you are not very concerned about performance.

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

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

If the attribute is temporarily unable to be read this method returns E_PENDING.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlReader Methods