[Home] [By Thread] [By Date] [Recent Entries]


Dave Pawson scripsit:

> >\\machine\share\dir\file.xml
> >
> >is addressible using the URI
> >
> >file:////machine/share/dir/file.xml
> 
> Thanks Michael. One more to add to the test grouping!
> 4 slashes now!!!  Why must it be so confusing?

Actually, either 2 or 4 slashes is defensible.  Remember that the general
scheme of a typical URL (excluding things like mailto: and news:) is

	scheme://machine/path

where the third slash serves both to separate the machine from the path
and to indicate that the path is absolute.  So a file: URL referring to
the local file /bar/baz looks like:

	file://localhost/bar/baz

Equivalently, you can write

	file:///bar/baz

leaving the machine name is empty, because the local system is meant.
This is the most common form, so typically file URLs begin "file:///".

Now we have to decide whether we are going to interpret an UNC name as
containing separate machine and path information, or as just being a path.
In the former case, the natural approach is to map the first component
onto the "machine" part of the URL schema, like this:

	file://foo/bar/baz

This is naturally interpreted as being the file /bar/baz on machine foo
rather than the local machine, or \\foo\bar\baz in UNCspeak.

Alternatively, you can say that the UNC name is just a path with an
unusual first component "//foo", in which case the UNC name \\foo\bar\baz
would be written

	file://localhost//foo/bar/baz

which can be abbreviated to

	file:////foo/bar/baz

-- 
John Cowan      jcowan@r...        http://www.reutershealth.com
        "Not to know The Smiths is not to know K.X.U."  --K.X.U.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member