I am trying to create a javascript bookmarklet to import an xml file that is located on my pc. While I have found numerous examples of code that is part of a web page, I cannot get it to work as a bookmarklet.
The debug alerts are displaed until xmlDoc.load is called and then no error messages or anything else. This is running in Firefox 1.5.09 on windows 2000.
Any suggestions?
The debug alerts are displaed until xmlDoc.load is called and then no error messages or anything else. This is running in Firefox 1.5.09 on windows 2000.
Any suggestions?
Code:
javascript:function%20loadXML()
{
var dbug = 1;
var xmlfile = "c:\test.xml";
var xmlDoc;
function import_xml(file)
{
if (dbug) alert('ImportXML');
var xmlDoc; var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');
if (moz)
{
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = parse_xml;
}
else if (ie)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
while(xmlDoc.readyState != 4) {};
}
if (dbug) alert('Load');
xmlDoc.load(file);
if (dbug) alert('Loaded');
}
function parse_xml()
{
if (dbug) alert('parseXML');
}
if (dbug) alert('loadXML');
import_xml(xmlfile);
}loadXML();void(null)
Comment