Matt Chambers
Matt Chambers

Reputation: 2346

Is file://. a valid URI?

I expect this to mean "the current directory" which of course is meaningless on another machine or even at a different time, but it's triggering a schema error on Xerces and I think it's wrong to do so.

Upvotes: 2

Views: 263

Answers (1)

vcsjones
vcsjones

Reputation: 141588

No, it isn't. A file protocol has two parts, a host and a path. If you omit the host, the slash is still required. Yours is just a path. file:///. would probably be acceptable, but not what you are looking for. A file protocol is completely unaware of the current directory. That would expand to file://localhost/., which would mean a directory or file named . on the current system, as cHao noted in the comments.

Note that when omitting host you do not omit the slash ("file:///foo.txt" is okay, while "file://foo.txt" is not, although some interpreters manage to handle the latter)

Reference

Upvotes: 4

Related Questions