Easy Tutorial
❮ Dom Met Node Issamenode Met Document Getelementsbytagnamens ❯

XML DOM Browser Differences


Browser Differences in DOM Parsing

All modern browsers support the W3C DOM specification.

However, there are differences between browsers. A significant difference is:


DOM - Whitespace and Line Breaks

XML often contains line breaks or whitespace characters between nodes. This is common when editing documents with simple editors like Notepad.

The following example (edited with Notepad) includes CR/LF (line breaks) between each line and two spaces before each child node:

Internet Explorer will not treat empty whitespace or line breaks as text nodes, while other browsers will.

The following code snippet shows how many child nodes the root element has (from books.xml):

Example

Example explanation:

❮ Dom Met Node Issamenode Met Document Getelementsbytagnamens ❯