如何解析 URN?

发布于 2024-07-18 19:22:46 字数 184 浏览 4 评论 0 原文

我有一个 XML 架构文件,它引用基于 urn 的位置。 有什么方法可以将其解析为 url,或者有什么方法可以实际读取它引用的文件。

<xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclGrp.xsd:1.1"/>

I have an XML schema file which references a urn based location. Is there some way to resolve this into a url, or some way to actually read the file it refers to.

<xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclGrp.xsd:1.1"/>

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

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

发布评论

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

评论(3

甚是思念 2024-07-25 19:22:46

这个问题不是解释“URN 解析”的好地方......
我们可以想象从这个 oasis URN 到一个 schemaLocation 文件名或 URL 的翻译(通过自动翻译器),但这对于 URN 来说是一个有点奇特的应用程序。

请参阅 schemaLocation 的常用语义和值,网址为 http ://www.w3.org/TR/xmlschema-1/#schema-repr


#URN解析

可以看到维基百科上 URN 的现实示例以及术语“解析 URN”的完整语义RFC-2169RFC-2483 >。 根据这些 RFC,您需要的是本地软件或“URN 解析器”软件的 URL(webservice)执行N2L:给定一个URN,
返回一个网址。

广泛使用 URN

2002 年,URN 解析机制受到更多关注,并且出现了两个新的 RTF,RFC-3404RFC-3405,解决了一个潜在的问题URN 问题,

如果 URN 解析被折叠为通用 URI 解析,URN 可能会
由于未采用 URI 解析而受到影响。

解决方案是允许 URN 解析的快捷方式。 (...) 通用 URI 解析从插入开始
将已知 URI 方案的规则写入“uri.arpa”。 注册表。 为了
“URN:”URI 方案,“uri.arpa”中的规则之一。 会是为了
'urn' URI 方案。 该规则将简单地委托给
“瓮.arpa”。 用于基于 URN 命名空间的其他 NAPTR 的区域。
本质上,“URN:”的 URI 解析重写规则是 URN
解析应用程序的第一个众所周知的规则。

一些解析问题仍然存在:诸如 urn:doiurn:lex:br 有一个如此使用且稳定的解析机制(位于 dx.doi.orglexml.gov.br/urn 分别),但未在 IANA 的分配/urn-namespaces; 未使用、不稳定且不受控制的 URN(例如 urn:oasis:names:tc:dita)已在 IANA 注册了 urn:oasis

This question is not a good place for explanations about "URN resolution"...
We can imagine a translation (by an automatic translator) from this oasis URN to a schemaLocation filename or a URL, but it is a little bit exotic application for URNs.

See the usual semantic and values for schemaLocation at http://www.w3.org/TR/xmlschema-1/#schema-repr


#URN resolution

You can see real-life examples of URNs at Wikipedia and the complete semantic of the term "resolve a URN" at RFC-2169 and RFC-2483. According these RFCs what you need is a local software or a URL of a "URN resolver" software (a webservice) that do N2L: given a URN,
return a URL.

Wide use URNs

In 2002 the URN resolution mechanism received more attention, and two new RTFs, RFC-3404 and RFC-3405, solved a latent problem of URNs,

If URN resolution is collapsed into generic URI resolution, URNs may
suffer by the lack of adoption of URI resolution.

The solution is to allow for shortcutting for URN resolution. (...) generic URI resolution starts by inserting
rules for known URI schemes into the 'uri.arpa.' registry. For the
'URN:' URI scheme, one of the rules found in 'uri.arpa.' would be for
the 'urn' URI scheme. This rule would simply delegate to the
'urn.arpa.' zone for additional NAPTRs based on the URN namespace.
Essentially, the URI Resolution Rewrite Rule for 'URN:' is the URN
Resolution Application's First Well Known Rule.

Some resolution problems persist: URNs like urn:doi or urn:lex:br have a so used and stable resolution mechanism (at dx.doi.org and lexml.gov.br/urn respectively), but is not registered at IANA's assignments/urn-namespaces; a not used, not stable and not controlled URN like urn:oasis:names:tc:dita have urn:oasis registered at IANA.

鱼窥荷 2024-07-25 19:22:46

...也许看看 RFC3121 OASIS 的 URN 命名空间?

编辑:我永远记不起 URI 和 URN,但我的理解是它们只是命名空间,它们实际上不必对应于网络上存储文件的某个真实位置。 他们只是划分了对命名空间部分的控制,因此 urn:oasis 处于 OASIS 的控制之下。 您不应该发明层次结构该部分中的任何 URI/URN,除非您可以控制它。

编辑2:在 oasis-open.org 中进行了一些谷歌搜索,名为 tblDeclGrp.xsd 和一些 对其和其他模式的评论

...maybe look at RFC3121 A URN Namespace for OASIS?

edit: I can never remember URIs and URNs, but my understanding is they're just namespaces, they don't actually have to correspond to some real location on the network where a file is stored. They just divide up control over portions of the namespace so urn:oasis is under control of OASIS. You're not supposed to invent any URIs / URNs that are within that section of the hierarchy unless you have control over it.

edit 2: A little google searching found a file in oasis-open.org called tblDeclGrp.xsd and some commentary on it and other schemas.

笑咖 2024-07-25 19:22:46

在本例中,schemaLocation 就是位置。 如果您在同一目录中有一个与此名称完全相同的文件,则应该对其进行解析。 它甚至包括 urn: 部分,所以完整的字符串。 在模式命名空间之后命名文件只是方便而已。 我必须承认一开始很混乱。

顺便提一句。 瓮不是一个位置,它只是一个 URI。 xs:include schemaLocation 的属性引用位置,但属性类型为包含 urn 架构的 anyURI

The schemaLocation is in this case the location. If you have a file named exactly like this in the same directory it should be resolved. It is even include the urn: part so the complete string. It is just convienient to name the file after the schema namespace. Confusing at first I must admit.

Btw. the urn is not a location it is just an URI. The attribute of the xs:include schemaLocation that refers to a location but the attribute type is anyURI which includes urn schema

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