This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > March 2006 > File path in MS XML parser





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author File path in MS XML parser
Mateo

2006-03-16, 6:20 pm

Hi!


When I write this:

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("filename.xml");

it works fine.... it opens file etc.....


But, what if my file is not in samefolder.... what if I want to open file by
dialog
and give it's path...

xmlDoc.load("C:\FolderName\filename.xml");


It doesn't wont to open XML file..... why?
How can I enter file path in load() method?


Thanx!





Anthony Jones

2006-03-16, 6:20 pm


"Mateo" <mateo.perak@st.htnet.hr> wrote in message
news:dvchpd$ni3$1@ss405.t-com.hr...
> Hi!
>
>
> When I write this:
>
> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
> xmlDoc.load("filename.xml");
>
> it works fine.... it opens file etc.....
>
>
> But, what if my file is not in samefolder.... what if I want to open file

by
> dialog
> and give it's path...
>
> xmlDoc.load("C:\FolderName\filename.xml");
>
>
> It doesn't wont to open XML file..... why?
> How can I enter file path in load() method?
>
>
> Thanx!
>


What do you mean ' It doesn't wont to open XML file'?

Do you get an error?
Does the xmlDoc simply appear not to load?
If alert xmlDoc.parseError.reason has it failed to parse?

Try also:-

xmlDoc.async = false;
xmlDoc.load("filename.xml");

Anthony.


Mateo

2006-03-17, 6:14 am

It simply does not wont to open XML file.... Problem is I don't know if
xmlDoc object is now undefined or whatever, becouse my JavaScript debugging
in .Net studi doesn't work... Don't know why... But it works when I put
xmlDoc.load("filename.xml"); and it doesnot work when I put
xmlDoc.load("C:\FolderName\filename.xml");

Don't know why:(((((((

Please help!

"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:%238XGyzUSGHA.196@TK2MSFTNGP10.phx.gbl...
>
> "Mateo" <mateo.perak@st.htnet.hr> wrote in message
> news:dvchpd$ni3$1@ss405.t-com.hr...
> by
>
> What do you mean ' It doesn't wont to open XML file'?
>
> Do you get an error?
> Does the xmlDoc simply appear not to load?
> If alert xmlDoc.parseError.reason has it failed to parse?
>
> Try also:-
>
> xmlDoc.async = false;
> xmlDoc.load("filename.xml");
>
> Anthony.
>
>



Anthony Jones

2006-03-17, 6:14 am


"Mateo" <mateo.perak@st.htnet.hr> wrote in message
news:dvdt67$22h$1@ss405.t-com.hr...
> It simply does not wont to open XML file.... Problem is I don't know if
> xmlDoc object is now undefined or whatever, becouse my JavaScript

debugging
> in .Net studi doesn't work... Don't know why... But it works when I put
> xmlDoc.load("filename.xml"); and it doesnot work when I put
> xmlDoc.load("C:\FolderName\filename.xml");
>
> Don't know why:(((((((
>


And the answers to my questions are....??


Mateo

2006-03-17, 6:14 am

Sorry:)

What do you mean ' It doesn't wont to open XML file'?
- it means that script simply will not continiue over line with .load()
method

Do you get an error?
-No.

Does the xmlDoc simply appear not to load?
-Yes

If alert xmlDoc.parseError.reason has it failed to parse?
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

xmlDoc.async = "false";


path = document.Form1.txtPath.value;


xmlDoc.load('C:\file.xml');

alert (xmlDoc.parseError.reason);

This parseError.reason can not even be executed.... becouse script crashes
in line
xmlDoc.load('C:\file.xml');
works fine when I put xmlDoc.load('file.xml'); then parseError.reason
returns empty....

Problem is I can not provide more informations becouse my JavaScript
debugger in Vs.Net 2003 doesnt work.
It simply ignores breakpoints!!!



"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:O49qxEaSGHA.4960@TK2MSFTNGP12.phx.gbl...
>
> "Mateo" <mateo.perak@st.htnet.hr> wrote in message
> news:dvdt67$22h$1@ss405.t-com.hr...
> debugging
>
> And the answers to my questions are....??
>
>



Anthony Jones

2006-03-17, 6:14 am


"Mateo" <mateo.perak@st.htnet.hr> wrote in message
news:dvdvu0$8ha$1@ss405.t-com.hr...
> Sorry:)
>
> What do you mean ' It doesn't wont to open XML file'?
> - it means that script simply will not continiue over line with .load()
> method
>
> Do you get an error?
> -No.
>
> Does the xmlDoc simply appear not to load?
> -Yes
>
> If alert xmlDoc.parseError.reason has it failed to parse?
> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
>
> xmlDoc.async = "false";
>
>
> path = document.Form1.txtPath.value;
>
>
> xmlDoc.load('C:\file.xml');
>
> alert (xmlDoc.parseError.reason);
>
> This parseError.reason can not even be executed.... becouse script crashes
> in line
> xmlDoc.load('C:\file.xml');
> works fine when I put xmlDoc.load('file.xml'); then parseError.reason
> returns empty....
>
> Problem is I can not provide more informations becouse my JavaScript
> debugger in Vs.Net 2003 doesnt work.
> It simply ignores breakpoints!!!
>
>


Is this ASP or a local .js file?
If ASP have you enabled debugging in the application configuration?
Have you checked permissions?

Anthony


Martin Honnen

2006-03-17, 6:18 pm



Mateo wrote:


> xmlDoc.load("C:\FolderName\filename.xml");


With J(ava)Script the \ is used as an escape character so you need
xmlDoc.load("C:\\FolderName\\filename.xml")


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Anthony Jones

2006-03-17, 6:18 pm


"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:eJ$bZ5cSGHA.4300@TK2MSFTNGP14.phx.gbl...
>
>
> Mateo wrote:
>
>
>
> With J(ava)Script the \ is used as an escape character so you need
> xmlDoc.load("C:\\FolderName\\filename.xml")
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/


LOL, well spotted Martin :)



Mateo

2006-03-18, 6:20 pm

You are right... but still doesn't working:(

xmlDoc.load("C:\\FolderName\\filename.xml") ;

returns an error:
msxml3.dll: Access is denied. :((((((((((((((


"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:eJ$bZ5cSGHA.4300@TK2MSFTNGP14.phx.gbl...
>
>
> Mateo wrote:
>
>
>
> With J(ava)Script the \ is used as an escape character so you need
> xmlDoc.load("C:\\FolderName\\filename.xml")
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/



Anthony Jones

2006-03-19, 6:14 am


"Mateo" <mateo.perak@st.htnet.hr> wrote in message
news:dvhori$q2u$1@ss405.t-com.hr...
> You are right... but still doesn't working:(
>
> xmlDoc.load("C:\\FolderName\\filename.xml") ;
>
> returns an error:
> msxml3.dll: Access is denied. :((((((((((((((
>
>
> "Martin Honnen" <mahotrash@yahoo.de> wrote in message
> news:eJ$bZ5cSGHA.4300@TK2MSFTNGP14.phx.gbl...
>


Can you answer the questions in my previous post namely:-

Is this ASP or a local .js file?
Have you checked permissions?


Martin Honnen

2006-03-19, 6:23 pm



Mateo wrote:

> xmlDoc.load("C:\\FolderName\\filename.xml") ;
>
> returns an error:
> msxml3.dll: Access is denied. :((((((((((((((


Then make sure you use MSXML in an environment like WSH or HTA or ASP
where there are no security restrictions. Then of course you need to
make sure the user the script is run with has the permissions to access
that directory named FolderName on the C drive and the file named
filename.xml in that directory.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mateo

2006-03-19, 6:23 pm

Is this ASP or a local .js file?
- client side Java script stored in .js file

If ASP have you enabled debugging in the application configuration?
- debuggingn now works fine....

Have you checked permissions?
- Yes....


:(((((((((((((





"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:OxqFO6ySGHA.5436@TK2MSFTNGP10.phx.gbl...
>
> "Mateo" <mateo.perak@st.htnet.hr> wrote in message
> news:dvhori$q2u$1@ss405.t-com.hr...
>
> Can you answer the questions in my previous post namely:-
>
> Is this ASP or a local .js file?
> Have you checked permissions?
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews