----- Original Message -----
Sent: Tuesday, January 21, 2003 5:34
PM
Subject: RE: [dom4j-user] Cannot read
file on windows server
I tried file:////server/path/file,
but then I get at some point /server/path/file (even tried file://///server/path/file)
this makes me loose the fact that server is the name of the server and not
part an ordinary path.
if I try to open the same file with: new File("//server/path/file")
I have no problem at all accessing the file
hans
NADJEMI Othmane <[EMAIL PROTECTED]>
21/01/2003 17:54
why you don't used the file protocol:
reader.read("file:/you
path");
Othmane
-----Message d'origine-----
De :
James Strachan [mailto:[EMAIL PROTECTED]]
Envoyé :
mardi 21 janvier 2003 17:51
À : [EMAIL PROTECTED];
[EMAIL PROTECTED]
Objet : Re: [dom4j-user]
Cannot read file on windows server
I've never tried to upen those
kinds of URIs in Java yet so can't really help. My only tip could be to try
encoding the \\.
e.g.
reader.read( "\\\\server\\path\\file"
);
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: [EMAIL PROTECTED]
To: James
Strachan
Sent: Tuesday, January 21, 2003 4:54 PM
Subject: Re: [dom4j-user] Cannot read file on windows
server
No, server means really a server
name
it is like in the windows explorer
\\server\path\file
if I use something like /path/file or d:/path/file everything works
fine
hans
"James Strachan"
<[EMAIL PROTECTED]>
21/01/2003 16:36 GMT
To:
"Keysers, Wonne" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
bcc:
Subject:
Re: [dom4j-user] Cannot read file on windows server
"server" is a directory name right? And this is all available on the
local file system?
Why not just try using Unix
style paths on windows which often gets around the backslash
woes.
Document doc = reader.read( "/server/path/xmlfile.xml" );
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: [EMAIL PROTECTED]
To: Keysers,
Wonne
Cc:
Sent: Tuesday, January 21, 2003
3:35 PM
Subject: RE: [dom4j-user] Cannot read
file on windows server
I tried what you said
and I'm back in situation number 1 (ftp)
code:
SAXReader reader = new SAXReader();
Document document = reader.read(new URL("file", "server",
"/path/xmlfile.xml"));
stacktrace
Thread[main,5,main]
(Vivant): Exception détectée :
java.lang.ClassNotFoundException
Class.forName0(String,
boolean, ClassLoader)
Class.forName(String)
URL.getURLStreamHandler(String)
URL(String, String,
int, String, URLStreamHandler)
URL(String, String, int,
String)
URL(String, String, String)
(2)
Handler.openConnection(URL)
(1)
URL.openConnection()
XmlParser.pushURL(String,
String, String, Reader, InputStream, String)
XmlParser.doParse(String,
String, Reader, InputStream, String)
SAXDriver.parse(InputSource)
SAXReader.read(InputSource)
SAXReader.read(URL)
Test.main(String
[])
at (1) the protocol = file; at
(2) the protocol equals ftp
I'm on
windows
and the ultimate goal is to
load a file when I only now
\\server\\path\\xmlfile.xml
hans
"Keysers, Wonne"
<[EMAIL PROTECTED]>
Sent by:
[EMAIL PROTECTED]
21/01/2003
15:40
To:
"'[EMAIL PROTECTED] '"
<[EMAIL PROTECTED]>
cc:
bcc:
Subject: RE: [dom4j-user]
Cannot read file on windows server
Hi
This works fine on
NT:
reader.read( new URL( "file",
"host", "/full/path/file.xml") );
I'm not sure, but if
you work on Unix, it might also be:
reader.read( new
URL( "smb", "host", "/full/path/file.xml") );
Best
regards
Wonne
-----Original
Message-----
From:
[EMAIL PROTECTED]
To: James
Strachan
Cc: Keysers, Wonne;
[EMAIL PROTECTED]
Sent: 1/21/2003 3:40
PM
Subject: Re: [dom4j-user]
Cannot read file on windows server
Hello,
Wonne, James
Thank you (dank u ;) for the
help, but it does not solve the problem
completely.
I did some debugging and
indeed with file:////server/path/xmlfile.xml it
doesn't try to do an ftp, but my filename gets
changed to
/server/path/xmlfile.xml
The // that I need to indicate a network path in windows is lost
hans
"James Strachan" <[EMAIL PROTECTED]>
Sent by:
[EMAIL PROTECTED]
21/01/2003 14:11 GMT
To: "Keysers, Wonne" <[EMAIL PROTECTED]>,
<[EMAIL PROTECTED]>
cc:
bcc:
Subject: Re: [dom4j-user] Cannot read file on windows
server
Agreed. The
read method can take a File, a URL, or a String url as well
as an InputStream or Reader - though the first
3 are preferred as it
gives the
default EntityResolver implementation a chance..
James
-------
http://radio.weblogs.com/0112098/ <http://radio.weblogs.com/0112098/>
-----
Original Message -----
From: Keysers, Wonne
<mailto:[EMAIL PROTECTED]>
To: '[EMAIL PROTECTED] <mailto:>
Sent: Tuesday, January 21, 2003 11:14 AM
Subject: RE: [dom4j-user] Cannot read file on
windows server
Hi (Dag :-)
Hans,
I believe this should work:
reader.read( new URL(" file:////server/path/file.xml
<file:////server/path/file.xml> ") );
Wonne
-----Original Message-----
From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Sent: 1/21/2003 11:26 AM
Subject: [dom4j-user]
Cannot read file on windows server
Hello,
I want to access open an xml file located on a
distant server
\\server\path\myxml.xml".
If I try to open the file with the java File class,
all goes perfectly
well.
If I
try to execute following code I get a connection error:
f = new File(_fileName);
if
(!f.exists()) {
throw new error
}
reader = new SAXReader();
document =
reader.read("file:".concat(_fileName));
If the
last line contains "file:" or not does not make a difference.
After some debugging I noticed that an URL is made and that it is the
URL
that is opened.
in the debugger I stopped on the error and noticed
that in
Handler.openConnection(URL) the protocol is
file but in the URL(String,
String, String) that is
called from this one, the protocol changed into
ftp.
(since no ftp server is running on the windows machine, this error
is
logical)
I tried to do
document =
reader.read(filereader);
but even when I pass an
inputstream that is open and has access to the
file,
an URL is made and used.
I hope someone can help
me with this.
Thank you
Hans
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com <http://www.vasoftware.com>
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user
<https://lists.sourceforge.net/lists/listinfo/dom4j-user>
------------------------------------------------------- This SF.net
email is sponsored by: Scholarships for Techies! Can't afford IT training? All
2003 ictp students receive scholarships. Get hands-on training in Microsoft,
Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp
_______________________________________________ dom4j-user mailing list
[EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
------------------------------------------------------- This
SF.net email is sponsored by: Scholarships for Techies! Can't afford IT
training? All 2003 ictp students receive scholarships. Get hands-on training
in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________ dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user