是否有空 URI? [英] Is there an empty URI?

查看:57
本文介绍了是否有空 URI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个解析 URI 的例程.在明显的情况下,有一个空字符串情况.空字符串是有效输入吗?空字符串的结果 URI 是什么?

I working on a routine that parses a URI. Among obvious cases there is an empty string case. Is the empty string a valid input? What would be an outcome URI of an empty string?

推荐答案

空字符串不可能是 URI.通用 URI 语法 指定至少 scheme组件后跟 : 后跟 hier-part 组件(可能为空)必须存在.

An empty string can’t possibly be a URI. The general URI syntax specifies that at least the scheme component followed by a : followed by the hier-part component (which may be empty) must be present.

相对 URI 引用可以为空.相对引用的语法规定至少relative-part 组件必须存在,但允许为空 (path-empty).

But a relative URI reference can be empty. The syntax of relative references specifies that at least the relative-part component must be present, but it’s allowed to be empty (path-empty).

相对 URI 引用是一个 相同文档引用(粗体强调我的):

An empty relative URI reference is a same-document reference (bold emphasis mine):

最常见的相同文档引用示例是空的相对引用或仅包含数字符号(#")分隔符后跟片段标识符.

The most frequent examples of same-document references are relative references that are empty or include only the number sign ("#") separator followed by a fragment identifier.

这篇关于是否有空 URI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆