item Property [DOM]

[This sample code uses features that were first implemented in MSXML 5.0 for Microsoft Office Applications.]

Returns the item from the collection with the specified index. The index starts at zero.

var objErr = IXMLDOMParseErrorCollection.item(index);

Set objErr = IXMLDOMParseErrorCollection.item(index);

IXMLDOMParseError2Ptr objErr=objIXMLDOMParseErrorCollection->item[index];

HRESULT get_item(
    LONG index,
    IXMLDOMParseError2 **objErr);

Parameters

index

A LONG value specifying a zero-based index as the input.

objErr

A pointer to an IXMLDOMParseError2 object corresponding to the specified item index in the error collection.

Return Values

S_OK

The value returned if successful. The resultant objErr parameter is not NULL.

E_FAIL

The value returned if the index is out of bounds.

The following code performs an XSD validation on an XML document that has two invalid <book> nodes. The code then iterates through the resultant error collection, and examines each item retrieved.

This example uses the same two resource files used in the allErrors example. We've provided source files for the sample in two languages: JScript and C++. The output is the same in each language.

Implemented in: MSXML 5.0 for Microsoft Office Applications and later

Show:
© 2014 Microsoft