Re: newbie question

Martin Honnen <[email protected]> Tue, 04 Sep 2007 12:49:20 +0200
Newsgroups gmane.comp.mozilla.devel.xml
Organization Liberty Development
Message-ID <[email protected]>
mlabs wrote:
> i have an xpcom component that needs to read a string out of a local
> XML file .. in a folder somewhere on my machine .. say 'c:\foo
> \settings.xml'
> 
> I try this:
> 
>         xmlDoc = document.implementation.createDocument("", "", null);
>         xmlDoc.async = false;
>         xmlDoc.load("c:\foo\settings.xml");

Backslashes in JavaScript string literals need to be escaped so you 
would need
   xmlDoc.load("c:\\foo\\settings.xml");
to access the file at c:\foo\settings.xml.

> 
> but it throws an exception. Moving the xml file alongside the JS file
> and calling load("settings.xml") works, but this is not an option.
> 
> Q: how do I specify a full path to an XML file for loading??

What exception exactly do you get?


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/