The parseError object returns information about the last parse error. To demonstrate how the parseError object works, we need to use an XML document with an error in it. Code Listing A-1a (AppxA\LstA_1a.xml on the companion CD) is the email document with the Cc and Bcc elements reversed, which is an error according to the DTD.
Code Listing A-1a.
|
The list below shows the properties available for the parseError object:
Returns the error code of the last parse error.
Basic Syntax | intErrorValue = xmlDocument.parseError.errorCode; |
Details | Returns a long integer. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_66.htm on the companion CD:
intParseValue = xmlDoc.parseError.errorCode; alert(intParseValue); |
Returns the position in the file where the error occurred.
Basic Syntax | intErrorValue = xmlDocument.parseError.filePos; |
Details | Returns a long integer representing the absolute position (in number of characters) of the error. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_67.htm on the companion CD:
intParseValue = xmlDoc.parseError.filePos; alert(intParseValue); |
Returns the line number where the error occurred.
Basic Syntax | intErrorValue = xmlDocument.parseError.line; |
Details | Returns a long integer representing the line number where the error occurred. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_68.htm on the companion CD:
intParseValue = xmlDoc.parseError.line; alert(intParseValue); |
Returns the position in the line where the error occurred.
Basic Syntax | intErrorValue = xmlDocument.parseError.linePos; |
Details | Returns a long integer representing the character position in the line where the error occurred. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_69.htm on the companion CD:
intParseValue = xmlDoc.parseError.linePos; alert(intParseValue); |
Returns the reason for the last parse error.
Basic Syntax | strErrorReason = xmlDocument.parseError.reason; |
Details | Returns a string containing a description of the reason for the last parse error. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_70.htm on the companion CD:
strErrorReason = xmlDoc.parseError.reason; alert(strErrorReason); |
Returns the text of the line containing the error.
Basic Syntax | strSrcText = xmlDocument.parseError.srcText; |
Details | Returns a string containing the full text of the line that contains the error, including white space. This property is read-only. |
Usage Example The following example can be found in AppxA\LstA_71.htm on the companion CD:
strSrcText = xmlDoc.parseError.srcText; alert(strSrcText); |