Easy Tutorial
❮ Xml Applications Xml Cdata ❯

XML Parser

All modern browsers have built-in XML parsers.

The XML parser converts an XML document into an XML DOM object - an object that can be manipulated with JavaScript.


Parsing an XML Document

The following code snippet parses an XML document into an XML DOM object:


Parsing an XML String

The following code snippet parses an XML string into an XML DOM object:

Note: Internet Explorer uses the loadXML() method to parse an XML string, while other browsers use the DOMParser object.


Cross-Domain Access

For security reasons, modern browsers do not allow cross-domain access.

This means that both the web page and the XML file it attempts to load must be located on the same server.


XML DOM

In the next chapter, you will learn how to access the XML DOM object and retrieve data.

❮ Xml Applications Xml Cdata ❯