allErrors Property
This read-only property returns a parseErrorCollection
object containing all errors and warnings found during validation.
Script Syntax
var oAllErrs = objXMLDOMParseError2.allErrors;
Visual Basic Syntax
Set oAllErrs = objXMLDOMParseError2.allErrors;
C/C++ Syntax Using Smart Pointers
IXMLDOMParseErrorCollectionPtr oAllErrs=objXMLDOMParseError2->allErrors;
C/C++ Syntax
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 aparseErrorCollection
object.
Remarks
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.
Example
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.
- Resource Files (books.xml and books.xsd)
- JScript Code (allErrors.js)
- Visual Basic Code (allErrors.frm)
- C/C++ Code (allErrors.cpp)
- Output for the allErrors Example
Applies To
Versioning
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
errorParameters Method | errorParametersCount Property | errorXPath Property | IXMLDOMParseErrorCollection Interface