errorXPath Property
This read-only property returns an XPath expression that locates the node where an error occurred. Currently, this property is set only when an error is encountered in schema validation (using XSD). In all other cases, the returned string will be empty.
If there are multiple validation errors, the returned XPath expression points to the first node in the document where errors occurred.
Script Syntax
strXPath = objXMLDOMParseError2.errorXPath;
Visual Basic Syntax
strXPath = objXMLDOMParseError2.errorXPath;
C/C++ Syntax Using Smart Pointers
_bstr_t strXPath = objXMLDOMParseError2->errorXPath;
C/C++ Syntax
HRESULT get_errorXPath ( BSTR *strXPath);
Parameters
- strXPath [out,retval]
- A pointer to a BSTR string that contains an XPath expression, or is empty.
Return Values
- S_OK
- The property was retrieved successfully.
- E_FAIL
- Failed to retrieve the property and the resultant
strXPath
parameter is an empty string.
Example
This example uses the same two resource files used in the allErrors example, books.xml and books.xsd. 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 (errorXPath.js)
- Visual Basic Code (errorXPath.frm)
- C/C++ Code (errrorXPath.cpp)
- Output for the errorXPath 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
allErrors Property | errorParameters Method| errorParametersCount Property | validate Method | validateNode Method