开发者

Is it right to say that paths are represented as URI while web-addresses are represented as URL?

开发者 https://www.devze.com 2022-12-17 10:57 出处:网络
I am confused by Apple\'s documentation about the NSURL class开发者_如何学C. In NSURL, they say the following:

I am confused by Apple's documentation about the NSURL class开发者_如何学C.

In NSURL, they say the following:

  • NSURL understands URLs in style of RFC 1808, 1738 und 2732
  • NSURL understands URIs in style of RFC 2396

Also they say that the RFC 2396 URI are paths.

Now what's the difference here? Isn't a path also an URL? I mean, it's an location or not?


Both URLs and URIs identify resources (which are anything). However, a URL is the term used for an identifier that specifies how to locate the resource.

Let's consider other kinds of identifiers to help make this clear. An ISBN code identifies a book but does not specify how to find it. A Dewey Decimal or Library of Congress number also identifies a book and is also used to organize books in a library -- given the number you can find the book on a shelf in the library.

Getting back to URIs and URLs, a URI that refers to the location or path of a file is by definition a URL.

NSURL can also be used to parse and manipulate URIs that do not locate resources but merely identify them.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号