Returns an IXMLDOMParseError
object that contains information about the last parsing error.
var objError = objXMLDOMDocument.parseError;
The following script example uses the document's parseError
property to create an IXMLDOMParseError
object. It then tests the error and displays a message if one occurs.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var myErr; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { myErr = xmlDoc.parseError; if (myErr.errorCode != 0) { alert("You have error " + myErr.reason); } }
Set objError = objXMLDOMDocument.parseError
The following Microsoft® Visual Basic® example uses the document's parseError
property to create an IXMLDOMParseError
object. It then tests the error and displays a message if one occurs.
Dim xmlDoc As New Msxml2.DOMDocument50 Dim myErr As IXMLDOMParseError xmlDoc.async = False xmlDoc.Load ("books.xml") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set myErr = xmlDoc.parseError If (myErr.errorCode <> 0) Then MsgBox ("You have error " & myErr.reason) End If End If
HRESULT get_parseError( IXMLDOMParseError **errorObj);
DOMParseError
object. The errorObj
parameter is always a valid object.errorObj
parameter is Null.IXMLDOMParseError *pIParseError = NULL; HRESULT hr; IXMLDOMDocument *pIXMLDOMDocument = NULL; wstring strOutput = _T("Load Error"); // Initialize pIXMLDOMDocument (create a DOMDocument). // Load document. try { hr = pIXMLDOMDocument->get_parseError(&pIParseError); SUCCEEDED(hr) ? 0 : throw hr; if(pIParseError ) { hr = pIParseError->get_errorCode(&value); if(SUCCEEDED(hr)) { strOutput = (value != 0) ? _T("Load Error") : _T("Load Succeeded"); } pIParseError->Release(); pIParseError = NULL; } } catch(...) { if(pIParseError) pIParseError->Release(); DisplayErrorToUser(); } // Release the IXMLDOMDocument interface when finished with it.
The property is read-only. It returns IXMLDOMParseError
.
This member is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).
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.
Applies to: DOMDocument