Home > DeveloperSection > Forums > How to read XML file in javascript?
Vikas Giri
Vikas Giri

Total Post:13

Points:91
Posted on    April-28-2011 1:17 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 3980  View(s)
Rate this:
How to read xml file in javascript?
Please give the syntax
Thanks in advance.


Amit Singh

Total Post:103

Points:721
Posted on    April-28-2011 1:42 AM

Read XML file in javascript
Syntax:
 //Retrieving a XML file in IE5
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.load("xmlfile.xml");

    //Cross browser XML file retrieval
    if (window.ActiveXObject)
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    else if (document.implementation && document.implementation.createDocument)
        var xmlDoc = document.implementation.createDocument("", "doc", null);
    xmlDoc.load("xmlfile.xml");

use this syntax to load the xml file

Modified On Apr-28-2011 01:43:23 AM

Don't want to miss updates? Please click the below button!

Follow MindStick