XML中的默认名称空间确实需要URI吗? [英] Do default namespaces in XML really need a URI?

查看:183
本文介绍了XML中的默认名称空间确实需要URI吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于URI并不是真正指向Web位置,所以为什么XML中的默认名称空间需要URI? 为什么不能将任何元素的首次出现都放在某个标准的默认命名空间中?

Since URIs do not really refer to a web location, why do default namespaces in XML need a URI? Why can't the first appearance of any element be put in some standard default namespace?

推荐答案

The namespaces rec requires URI references for namespaces, so the status of some namespace as a default makes no difference. As for why any of them have to be URIs when in general they aren't dereferencable (RDF is non-compliant in this respect), why ask why? At Some Point, Someone Thought It Would Be A Good Idea, and lo, It Was Made So.

但是,您可能会混淆默认命名空间,而根本没有命名空间.没有标准默认"名称空间.

However, it's possible that you may be confusing a default namespace with no namespace at all. There is no "standard default" namespace.

文档中的默认名称空间由'xmlns'属性指定(无冒号,无后缀),并且可以具有作者喜欢的任何URI相似值.它没有必须具有的标准值.

The default namespace in a document is specified with the 'xmlns' attribute (no colon, no suffix) and can have any URI-lookalike value the author pleases. There is no standard value that it must have.

此外,xmlns属性规范是可选的.如果它不存在-允许它不存在-则根本没有默认名称空间.

Furthermore, the xmlns attribute specification is optional. If it isn't present - and it's allowed to be absent - then there is no default namespace at all.

这篇关于XML中的默认名称空间确实需要URI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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