我们什么时候会选择公共标识符而不是系统标识符来定位 DTD 文件?

发布于 2024-08-19 11:41:59 字数 315 浏览 1 评论 0原文

1) FPI可用于识别DTD文件。据我所知,FPI 与 URN 有点相似,因为它们唯一地标识资源( DTD 文件),那么为什么我们不使用 URN 而不是 FPI 来定位 DTD?换句话说,是什么让 FPI 能够更有效地识别 DTD 文件?

2) 我也不明白 FPI 在查找引用的 DTD 文件方面的用处。也就是说,XML 解析器“想要”从公共/系统标识符中得到的唯一东西就是让它们向解析器显示在哪里可以找到引用的 DTD 文件。既然 URL 能够出色地定位文件,为什么我们要使用 FPI 而不是 URL?

3)另外,FPI如何帮助解析器找到引用的DTD文件?

谢谢

1) FPIs can be used to identify DTD files. Since as far as I can tell, FPIs are somewhat similar to URNs in that they uniquely identify the resource ( DTD file ), then why don’t we use URNs instead of FPIs to locate DTDs? In other words, what makes FPIs more efficient in identifying DTD files?

2) I also don’t understand the usefulness of FPIs in finding referenced DTD files. Namely, the only thing XML parser “wants” from Public/System identifiers is for them to show the parser where to find referenced DTD file. Since URL does the job of locating the file superbly, why would we ever want to use FPI instead of a URL?

3) Also, how does FPI help parser to locate the referenced DTD file?

thanx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北渚 2024-08-26 11:41:59

解析器需要知道 FPI 以及如何解析它。通常,应用程序会使用所谓的目录文件来解释公共标识符。目录文件基本上会将公共标识符转换为适当的系统标识符(URI)。

另请参阅公共标识符、系统标识符和目录文件

FPI 必须是全局唯一的,而系统标识符如果使用 URL 或 URI,则可能是全局唯一的。由于系统标识符还可以使用文件系统路径或相对 URL/URI 说明符,因此它不能保证它在某些上下文中标识的资源的全局唯一性。

恕我直言,这仅与标准开发相关。对于正常的应用程序开发,系统标识符就足够了。

The parser needs to know the FPI and how to resolve it. Typically an application would use a so-called catalog file in order to interpret the public identifier. The catalog file would basically translate the public identifier to the appropriate system identifier (URI).

See also Public Identifiers, System Identifiers, and Catalog Files

An FPI must be globally unique while a system identifier can potentially be globally unique if it uses a URL or URI. Since a system identifier can also use a file-system path or relative URL/URI specifier, it cannot guarantee global uniqueness of the resource it identifies in some context.

IMHO, this is only relevant for standards development. For normal application development, system identifiers are sufficient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文