Spring bean DTD和XMLNS

当我创建一个弹簧项目时,我总是遇到XLMNS的问题。 什么是XMLNS? 实际上这些是什么?

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd" 

我在哪里可以获得这些参考? (xmlns的资源:xsi和xsi:schemeLocation。)是否有这些在线手册? 我似乎无法找到它们。

注意当我说引用时,我指的是适合它们的URL

更新

我在哪里可以看到Spring bean,Spring Transactions,Spring MVC等的XML命名空间? 及其架构位置?

这里有一个很好的解释: xsi:schemaLocation的用途是什么?

这是xsd config上的spring docs: http : //static.springsource.org/spring/docs/current/spring-framework-reference/html/xsd-config.html

注意:spring现在建议不要在xsd中包含版本号,除非特别要求,所以你应该:

 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" 

不是

 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" 

“xmlns”定义当前元素的名称空间。

“xmlns:aop”定义当前元素中元素的名称空间,前缀为“aop:”

这些行为您的XML文档设置名称空间。 根据您在XML文件中使用的标记,您需要顶部的命名空间(以及对正确模式的引用)才能使XML有效。

例如,如果在bean定义中使用标记,则需要在文件顶部引用aop模式: xmlns:aop="http://www.springframework.org/schema/aop"如果你没有使用那个标签,你就不需要那个。

对于您导入的任何名称空间,请确保在“xsi:schemaLocation”标记中添加对模式的引用,如下所示: xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

我建议您查看一个示例Spring应用程序,因为它应该具备运行所需的最低限度。

至于回答’在哪里记录’,我认为这取决于每个项目。 对于Spring,项目文档确实包含对此信息的引用。 例如,查看Spring Framework 3.2.x的xsd-config部分: 附录E.基于XML Schema的配置