Easy Tutorial
❮ Met Document Createelementns Dom Loadxmldoc ❯

XML DOM Parse Error Object


Microsoft's parseError object can be used to retrieve error information from Microsoft's XML parser.

To see how Firefox handles parser errors, check the next page of this tutorial.


parseError Object

A parser error (parser-error) may occur when you try to open an XML document.

With this parseError object, you can retrieve the error code, error text, the line causing the error, and more.

Note: The parseError object is not part of the W3C DOM standard!


File Error

In the following code, we attempt to load a non-existent file and display certain error properties:

Example


XML Error

In the following code, we will have the parser load a malformed XML document.

(You can read more about well-formed and valid XML in our XML Tutorial.)

Example

View XML File: note_error.xml


Properties of the parseError Object

Property Description
errorCode Returns a long integer error code.
reason Returns a string containing the reason for the error.
line Returns a long integer representing the line number of the error.
linepos Returns a long integer representing the line position of the error.
srcText Returns a string containing the line that caused the error.
url Returns the URL of the loaded document.
filepos Returns a long integer file position of the error.
❮ Met Document Createelementns Dom Loadxmldoc ❯