Easy Tutorial
❮ Met Document Createcdatasection Dom Nodes Create ❯

XML DOM Parser Error


When Firefox encounters a parser error, it loads an XML document containing the error.


Parser Errors in Firefox

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

Unlike Internet Explorer, if Firefox encounters an error, it loads an XML document containing the error description.

The root node of the XML error document is named "parsererror". This is used to check for errors.


XML Error

In the following code, we will make 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

Example Explanation:

Note: In reality, only Internet Explorer checks your XML with a DTD, Firefox does not.


Cross-Browser Error Checking

Here, we create an XML loading function to check for parser errors in both Internet Explorer and Firefox:

Example

View XML File: note_error.xml

Example Explanation - Internet Explorer:

Example Explanation - Firefox:

❮ Met Document Createcdatasection Dom Nodes Create ❯