newbie question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

newbie question

mlabs
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");

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??

_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: newbie question

Martin Honnen-3
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/
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml