Spring配置xml文件详解

1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4     xsi:schemaLocation="http://www.springframework.org/schema/beans
5     http://www.springframework.org/schema/beans/spring-beans.xsd">
6 </beans>

第一行:声明此文件xml格式,版本1.0 编码 UTF-8格式

第二行:插入beans标签并引入一个命名空间xmlns="http://www.springframework.org/schema/beans"没有使用命名空间前缀

第三行:xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"声明一个命名空间"http://www.w3.org/2001/XMLSchema-instance"前缀为xsi,此命名空间为xml遵循w3的一个标准标签规范命名空间。

第四行:使用xsi前缀的命名空间属性schemaLocation指定一个命名空间和schema文件的位置,注意顺序。

原文地址:https://www.cnblogs.com/hihtml5/p/5819101.html