Hi,
I am new to XML and I am trying to read an XML file 3 directory levels
up.
In the jsp I am setting the src to "..\..\..\directory\file.xml" and
I've tried "../../../directory/file.xml". Both these methods don't
seem to be able pick the xml file up.
If I put the file in the same directory it works ok.
By the way, I cannot move the file to the same directory as lots of
other files read this file in the current directory.
Can you help?? What am I doing wrong??
Regards
Simon
Roedy Green - 25 Oct 2005 14:40 GMT
>In the jsp I am setting the src to "..\..\..\directory\file.xml" and
>I've tried "../../../directory/file.xml". Both these methods don't
>seem to be able pick the xml file up.
You might try dumping the CWD. You might be surprised.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Oliver Wong - 25 Oct 2005 22:36 GMT
> Hi,
>
[quoted text clipped - 11 lines]
>
> Can you help?? What am I doing wrong??
If I take your explanation literally, it seems like the correct path
should be "..\..\..\file.xml", as you say it's 3 directories up, not 2
directories up, and 1 directory "sideways".
Have you tried moving the file just one directory up and doing
"..\file.xml" to see if you're suffering from some sort of "off by 1" error?
Have you tried creating a file object pointing to the current directory
and programmatically going up via .getParentFile()?
- Oliver
Roedy Green - 26 Oct 2005 02:09 GMT
> "..\..\..\directory\file.xml"
Don't forget that in Java strings, \ has to be doubled.
and in regexes quadrupled to get a literal \.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.