Contents Index Topic Contents | ||
Previous Topic: IXMLElementCollection::get_newEnum |
IXMLElementCollection::item
HRESULT IXMLElementCollection::item( VARIANT Var1, VARIANT Var2, IDispatch **ppDisp)
- Returns S_OK if successful. Error values include E_OUTOFMEMORY, E_INVALIDARG, and E_FAIL. ppDisp is set to NULL if the call fails.
- Var1
- Index or a name. The preferred variant type of an index is VT_I4; the preferred variant type of a name is VT_BSTR.
- Var2
- Empty (type VT_EMPTY) or an index.
- ppDisp
- Indirect pointer in which to return an address of the collection or element that is to be returned.
This method is fairly involved and can be used in different ways to retrieve members of a collection or another collection. If Var1 specifies an index and Var2 is empty, the item at that index is returned if such an element does exist. Var1 can also specify a name, in which case the returned object is a collection of all elements in this collection that have the specified name. However, if there is only one element with that name, the returned object is an XML element. It is also possible to specify Var1 as a name and Var2 as an index. In that case, the returned object is an XML element that is the Var2th object of the name specified by Var1. The caller must call IUnknown::Release on any returned objects.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.