Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable filename in the xmldocument.load() method???

Status
Not open for further replies.

threeo

Programmer
Mar 31, 2005
49
US
anyone know why......
i can't seem to use a variable for the filename when calling the xmldocument.load method.

if i explicitly type in the file like so: xmldocument.load("d:/xmlfiles/december.xml") it works fine and i can parse the xml nodes.

but....if i try assigning a variable for the filename...like so:
myfile = "d:/xmlfiles/december.xml" and then:
xmldocument.load(myfile) i get errors

if i response.write out myfile and cut and paste it into the method call it works.

i even tried appending double quotes at the beginning and end of the variable but it still won't work.

does anyone know how to use a variable filename for this method call?

threeo
 
It works fine for me. What Type have you declared your variable as? If it isn't a String make sure it is and also make sure to use the Trim method just in case you have preceding or trailing spaces.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
You know this:
Code:
myfile = "d:/xmlfiles/december.xml"
probably ought to be:
Code:
myfile = "d:\\xmlfiles\\december.xml"
Chip H.



____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
(If you're using C#)

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
i tried explicitly making the filename a string and it still didn't work. however.....
this time i put error handling in (try...catch...end try)
so i could see which file was not working and suddenly....now they all work just fine.

go figure!

thanks for your response!

threeo
 
Ahh the old heisenbug...!

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top