开发者

When would we choose Public identifier over System identifier to locate DTD file?

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


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜