---
title: "How to read XML file in javascript?"  
description: "How to read XML file in javascript?"  
author: "Anonymous User"  
published: 2011-04-28  
updated: 2011-04-28  
canonical: https://www.mindstick.com/forum/230/how-to-read-xml-file-in-javascript  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# How to read XML file in javascript?

How to read [xml file](https://www.mindstick.com/forum/360/how-to-read-xml-file-in-php) in [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)?\
Please give the syntax\
Thanks in advance.

## Replies

### Reply by Amit Singh

Read [XML](https://www.mindstick.com/blog/203/working-with-xml-data-in-sql-server) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) 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


---

Original Source: https://www.mindstick.com/forum/230/how-to-read-xml-file-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
