I am following https://developer.mozilla.org/en-US/docs/JXON to write an algorithm to convert an xml file to JSON. But, no luck. I think I am doing something wrong! What should I pass in place of "doc" in following line : var myObject = new JXONTree(doc); I have tried this : <!DOCTYPE html> <html lang="en"> <head> <title>Welcome</title> <script type="text/javascript" src="http://stackoverflow.com/questions/15539628/sample1.js"></script> <script type="text/javascript"> /* * Loading xml on the browser page */ function loadXML() { try { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", "sample.xml", false); xmlhttp.send(); } catch(e) { alert("Please enable file access to read config file"); } var response = xmlhttp.responseXML; if (response == null) { alert("Error in xml file ..Please check config.xml file is valid or not !"); } return response; } function myFun() { //Loading config xml var xmlDoc = loadXML(); var myObject = new JXONTree(xmlDoc); alert(myObject); } </script> </head> <body onload="myFun()"> Hello</body> </html> My sample.xml : <?xml version="1.0"?> <!DOCTYPE catalog SYSTEM "catalog.dtd"> <catalog> <product description="Cardigan Sweater"> <catalog_item gender="Men's"> <item_number>QWZ5671</item_number> <price>39.95</price> <size description="Medium"> <color_swatch image="red_cardigan.jpg">Red</color_swatch> <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch> </size> <size description="Large"> <color_swatch image="red_cardigan.jpg">Red</color_swatch> <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch> </size> </catalog_item> <catalog_item gender="Women's"> <item_number>RRX9856</item_number> <discount_until>Dec 25, 1995</discount_until> <price>42.50</price> <size description="Medium"> <color_swatch image="black_cardigan.jpg">Black</color_swatch> </size> </catalog_item> </product> <script type="text/javascript"><![CDATA[function matchwo(a,b) { if (a < b && a < 0) { return 1; } else { return 0; } }]]></script> </catalog>So, while running this, I get an error as below in Opera : Please enable file access to read config file. I have enabled Allow File XMLHttpRequest in Opera12. Still no luck! It works fine with Google Chrome. So what is it that I am missing?Please help. Thanks