allErrors Property

[This sample code uses features that are only implemented in MSXML 6.0.]

This read-only property returns a parseErrorCollection object containing all errors and warnings found during validation.

var oAllErrs = objXMLDOMParseError2.allErrors;

IXMLDOMParseErrorCollectionPtr oAllErrs=objXMLDOMParseError2->allErrors;

HRESULT get_allErrors(
    IXMLDOMParseErrorCollection **oAllErrs)

Parameters

oAllErrs[out,retval]

A pointer to the IXMLDOMParseErrorCollection object.

Return Values

S_OK

The error collection was retrieved successfully. The resultant error collection is never empty. If no errors were found during validation, the returned error collection contains the success code.

E_FAIL

The oAllErrs parameter was called on error item belonging to a parseErrorCollection object.

To retrieve multiple validation errors, you must enable MultipleErrorMessages on the DOM. To do so, you must explicitly set the MultipleErrorMessages parameter to true, as shown in the following JScript code fragment:

ObjDom.setProperty("MultipleErrorMessages", true);

The allErrors parameter is only meaningful when it is called on the top-level parseError object returned from a DOM object, as follows:

errCollection = domObj.parseError.allErrors;

It is an error to call the allErrors parameter on a parseError object returned at lower levels in the DOM such as in the following example:

ErrCollection = domObj.parseError.allErrors.item(0).allErrors;

In this case, the allErrors parameter returns NULL. The corresponding HRESULT value is E_FAIL.

The example uses two resource files, books.xml and books.xsd. The first is an XML data file, and the second is the XML Schema for the XML data. The XML document has two invalid <book> elements: <book id="bk002"> and <book id="bk003">. The sample application uses several methods and properties of the IXMLDOMParseError2 interface to examine the resulting parse errors.

We've provided source files for the sample in three languages: JScript, Visual Basic, and C++. The output is the same in each language.

Implemented in: MSXML 6.0.

Show:
© 2014 Microsoft