Reading XML files in JavaScript 

  1. Something  that works in both FF and IE but not Chrome or Safari perhpas it is instructive
  2. Something that seems to work everywhere

Some old things for IE only

  1. Simple example (field names known) -- 
  2. Generalization (load one field at a time, with field names known) -- Starting toward cross browser
  3. Parsing an XML file (with a very shallow tree), turning off the asynchronous pause, and traversing xmlDoc.documentElement.ChildNodes
  4. A simpler way? (using XML data islands) Data islands are little things, sort of like <embed>s in an HTML document.
  5. Reading XML, HTML, or .txt files Shallow trees but simple code.
  6. Parsing deeper trees -- Reading and parsing XML, plain text, and HTML files, recursively.
  7. Examining files in JavaScript -- Reading, parsing and displaying XML, plain text, and HTML files, recursively.
These examples use statements like
var xmlDoc=new ActiveXObject("microsoft.xmldom");


<xml id="xq" src="Intro.xml"></xml>

to affiliate file contents with JavaScript variables.

using datasrc="#ChunkOfXML"

Here's an example that embeds XML directly into an HTML document which, in turn, reads data from the XML.

A similar use of datasrc to read an XML file into HTML without use of JavaScript