加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

XML模式/命名空间

发布时间:2020-12-16 23:05:48 所属栏目:百科 来源:网络整理
导读:我经常在 XML模式文件中看到类似下面的代码.据我所知,xmlns是定义一个新的命名空间.但是,跟随xmlns的长URL是否真的有必要?我的意思是程序,解析器,无论真正调用什么,例如“http://www.springframework.org/schema/beans”?或者这条线就像这样: beans xmlns
我经常在 XML模式文件中看到类似下面的代码.据我所知,xmlns是定义一个新的命名空间.但是,跟随xmlns的长URL是否真的有必要?我的意思是程序,解析器,无论真正调用什么,例如“http://www.springframework.org/schema/beans”?或者这条线就像这样:

<beans xmlns="beansNamespace">

这是其中之一

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
"
>

解决方法

不,当它看到时,解析器不会转到 http://whatever
< element xmlns ='http://whatever...'u0026gt; The IETF recommends that XML namespaces be URIs,但该URI不必是HTTP URI,实际上它不需要附加任何“网络协议”.它们仅用于识别.

在某些情况下,人们将名称空间URI设计为HTTP URI,并在该URI处插入名称空间的人类可读文档.因此,如果一个人要访问该地方,他们将了解该命名空间的模式.但该公约并未得到广泛采用.

另见,What does “xmlns” in XML mean?
和,What causes a difference between a web service URL and a namespace?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读