是否有 xml 命名空间约定? [英] Is there a xml namespace convention?
问题描述
很抱歉在堆栈溢出中提出另一个问题.
xml命名空间有什么限制吗?
Sorry for raising another question in stack overflow.
Is there any restrictions for xml namespace?
我正在使用 python2 rdflib 手动创建一个 xml 文件.结果是 http://domain.xxx/subdirectory/ 和 http://domain.xxx/subdirectory/xxx# 可以是 xml 中的命名空间.但是,http://domain.xxx/subdirectory/xxx_ 无效.它自动转换为命名空间:http://domain.xxx/subdirectory/
I am using python2 rdflib to manually create a xml file.
It turns out http://domain.xxx/subdirectory/ and http://domain.xxx/subdirectory/xxx# could be a namespace in xml.
However, http://domain.xxx/subdirectory/xxx_ is not valid.
It automatically translated to namespace: http://domain.xxx/subdirectory/
rdflib 是否对处理命名空间或命名空间有限制,例如 http://domain.xxx/subdirectory/xxx_ 不是有效的.谢谢!
Is rdflib has restriction on handle the namespace or namespace like http://domain.xxx/subdirectory/xxx_ is not a valid one. Thanks!
推荐答案
属性的值,一个 URI 引用,是标识命名空间的命名空间名称.命名空间名称,为了达到其预期目的,应该具有唯一性和持久性的特征.目标不是直接用于检索模式(如果存在).
The attribute's value, a URI reference, is the namespace name identifying the namespace. The namespace name, to serve its intended purpose, should have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists).
命名空间(不是前缀)是唯一字符串就足够了,但在这种情况下,您通常会收到类似
It should suffice for the namespace (not the prefix) to be an unique string, but in this case you will usually get a warning like
命名空间警告:xmlns:URI ...不是绝对的
namespace warning : xmlns: URI ... is not absolute
按照惯例,它应该是一个
By convention, it should be a
- URI(XML 1.0,RFC3986) 根据 XML-1.0 命名空间的规范.
- IRI(XML 1.1,RFC3987) 根据 XML-1.1 命名空间的规范.
- URI (XML 1.0, RFC3986) according to the specification for XML-1.0 namespaces.
- IRI (XML 1.1, RFC3987) according to the specification for XML-1.1 namespaces.
这篇关于是否有 xml 命名空间约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!