cross-browser standard Xml processing in Java Script

javascript, xml

Solution

use the tutorials at w3schools.com. They indicate how to work with a variety of browsers

e.g. (a snippet)

try //Internet Explorer
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async="false";
  xmlDoc.loadXML(txt);
  return xmlDoc;
  }
catch(e)
  {
  parser=new DOMParser();
  xmlDoc=parser.parseFromString(txt,"text/xml");
  return xmlDoc;
  }

Also, just to answer your direct question. The is a standard way (in the snippet above, it's in the catch block), but internet explorer doesn't support the standard way.... so you're stuck with something like the above

Problem

I am trying to figure out how to process XML in java script So i googled for it. The problem is , I don't know whether the tutorials I see will work only on IE. What is the "Standard" way to process Xml data in java script? Edit: Thanks for all your answers. I want to ask another question then. Is there some kind of 3rd party library which let me transperatly write JS code without worry about cross-browser functionality

Original source