【发布时间】:2011-05-09 19:49:27
【问题描述】:
我经常在 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
"
>
【问题讨论】:
标签: xml xsd xml-namespaces