先上一段xml文档

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
">
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"></bean>
<bean id="transactionManager"
class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
<batch:job id="iconvJob">
<batch:step id="iconvStep">
<batch:tasklet transaction-manager="transactionManager">
<batch:chunk reader="iconvItemReader" writer="iconvItemWriter"
processor="iconvItemProcessor" commit-interval="1" />
</batch:tasklet>
</batch:step>
</batch:job>
<context:property-placeholder location="classpath:files.properties" />
<bean id="iconvItemReader" class="com.inetpsa.batch.iconv.IconvItemReader">
<property name="input" value="file:${input.file}" />
<property name="charset" value="UTF-8" />
</bean>
<bean id="iconvItemWriter" class="com.inetpsa.batch.iconv.IconvItemWriter">
<property name="output" value="file:${output.file}" />
<property name="charset" value="UTF-8" />
</bean>
<bean id="iconvItemProcessor" class="com.inetpsa.batch.iconv.IconvItemProcessor" />
</beans>

从头开始解释:

1.xmlns

xmlns="http://www.springframework.org/schema/beans"

指定了该xml的默认的namespace是:xmlns="http://www.springframework.org/schema/beans",对,这是一个URI,(至于URI和URL的区别,引用知乎上的一句话解释:URI 和 URL 都定义了 what the resource is。URL 还定义了 how to get the resource。),这个URI在后面的 xsi:schemaLocation 中需要用到,来引入该namespace对应的schema的URL:

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

其中红色的两部分用空格分隔,前面是该namespace的值,该值和前面用xmlns定义的是一致的,后半部分定义了该namespace对应的schema的地址,可以用浏览器打开看一下,就是一个schema文档,这个文档其实就是Spring XML Beans Schema。所以本文一开始的xml立案,<bean>标签不需要加什么前缀。

2.xmls:xsi

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="略"

主要是上面这个地方用到了xsi,到底是什么意思呢,其实该前缀的名称也是可以变的,比如改成xsii也可以,只不过一定该属性的值是http://www.w3.org/2001/XMLSchema-instance

---

xml schema xmlns xmlns:xsi xsi:schemaLocation targetnamespace的更多相关文章

  1. XML Schema

    XML Schema 是基于 XML 的 DTD 替代者. XML Schema 描述 XML 文档的结构. XML Schema 语言也称作 XMLSchema 定义(XML Schema Defi ...

  2. xmlns:xsi ——是指xml文件遵守xml规范,xsi全名:xml schema instance

    http://blog.sina.com.cn/s/blog_4b6f8d150100nx3e.html http://blog.csdn.net/iaiti/article/details/4226 ...

  3. hibernate 注解配置<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/X

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  4. spring xml头文件xmlns和xsi的意思

    在spring的配置中,总能看见如下的代码: <beans xmlns="http://www.springframework.org/schema/beans" xmlns ...

  5. xmlns, xmlns:xsi, xsi:schemaLocation 解释

    xmlns, xmlns:xsi, xsi:schemaLocation 解释 xmlnsxsischemaLocation 我们在写 xml 文件时,尤其是 spring .mybatis 的配置文 ...

  6. xml文件中 xmlns xmlns:xsi 等解释

    http://bbs.csdn.NET/topics/390751819 maven 的 pom.xml 开头是下面这样的 <project xmlns="http://maven.a ...

  7. XML 中的 xmlns 等属性的意义

    原文:https://blog.csdn.net/lengxiao1993/article/details/77914155 Maven 是一个 java 开发人员很难绕过的构建工具, 因为有众多的开 ...

  8. 有关xml中的xmlns

    1. xmlns "xmlns"是XHTML namespace的缩写,叫做"名字空间"声明.名字空间是什么作用呢?我的理解是:由于xml允许你自己定义自己的标 ...

  9. XML Schema命名空间解析

    URI Web中汇集了各种资源.资源可以是具有标识的任何事物, 如文档. 文件. 菜单项. 计算机. 服务等, 甚至可以包括人. 组织和概念[BernersLee 1998].在Web体系结构中, ...

随机推荐

  1. 使用Powershell链接到Office 365

    今天主要讲使用Powershell管理Office 365 可以分为office365用户管理,Exchange Online的管理等 1. 使用Powershell 链接到office 365 用户 ...

  2. UIDynamic-附着行为:UIAttachmentBehavior

    直接上代码: // // YFAttachmentBehaviorViewController.m // BigShow1949 // // Created by apple on 16/8/25. ...

  3. js中let和var定义变量的区别

    let变量之前没见过,刚遇到,探探究竟. 以下转自:http://blog.csdn.net/nfer_zhuang/article/details/48781671 声明后未赋值,表现相同 (fun ...

  4. FFT小总结

    FFT实质上做的是循环卷积,ck=sigam(ai*bj,(i+j)%n=k),其中n是倍长后的长度,所以我们有时候需要的只是普通的卷积,我们就需要把原数组倍长,再用FFT求卷积,由于高位都是0,所以 ...

  5. gulp-rev同时将js和css文件写在一个rev-manifest.json文件里面的方式探讨

    参考: https://segmentfault.com/q/1010000002876613 https://github.com/sindresorhus/gulp-rev 测试发现,在官网上最主 ...

  6. Beta阶段第四次Scrum Meeting

    情况简述 Beta阶段第四次Scrum Meeting 敏捷开发起始时间 2016/12/13 24:00 敏捷开发终止时间 2016/12/14 24:00 会议基本内容摘要 进度平稳推进,分配新任 ...

  7. CSS-背景渐变的兼容写法

    background-image: -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.5) 75%); background-image: - ...

  8. iOS plist文件创建

    iOS中plist的创建,数据写入与读取功能创建一个test.plist文件,textInput作为输入,displayLabel作为显示,有一个按钮来触发保持程序triggerStorage: -( ...

  9. UITabBarController 、TabBar背景颜色设置,UITabBarItem的文字样式(颜色和大小)UITabBarItem的位置调整

    改变UITabBarController的颜色 UIView*mView=[[UIView alloc]initWithFrame:CGRectMake(0,0,320,48)];//这是部分tabb ...

  10. Android之自定义属性

    有些时候会觉得Android中提供的控件不能满足项目的要求,所以就会常常去自定义控件.自定义控件就不免会自定义属性.自定义属性大致需要三个步骤:在XML文件中定义自定义属性的名称和数据类型.在布局中调 ...