xml schema xmlns xmlns:xsi xsi:schemaLocation targetnamespace
先上一段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的更多相关文章
- XML Schema
XML Schema 是基于 XML 的 DTD 替代者. XML Schema 描述 XML 文档的结构. XML Schema 语言也称作 XMLSchema 定义(XML Schema Defi ...
- 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 ...
- 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 ...
- spring xml头文件xmlns和xsi的意思
在spring的配置中,总能看见如下的代码: <beans xmlns="http://www.springframework.org/schema/beans" xmlns ...
- xmlns, xmlns:xsi, xsi:schemaLocation 解释
xmlns, xmlns:xsi, xsi:schemaLocation 解释 xmlnsxsischemaLocation 我们在写 xml 文件时,尤其是 spring .mybatis 的配置文 ...
- xml文件中 xmlns xmlns:xsi 等解释
http://bbs.csdn.NET/topics/390751819 maven 的 pom.xml 开头是下面这样的 <project xmlns="http://maven.a ...
- XML 中的 xmlns 等属性的意义
原文:https://blog.csdn.net/lengxiao1993/article/details/77914155 Maven 是一个 java 开发人员很难绕过的构建工具, 因为有众多的开 ...
- 有关xml中的xmlns
1. xmlns "xmlns"是XHTML namespace的缩写,叫做"名字空间"声明.名字空间是什么作用呢?我的理解是:由于xml允许你自己定义自己的标 ...
- XML Schema命名空间解析
URI Web中汇集了各种资源.资源可以是具有标识的任何事物, 如文档. 文件. 菜单项. 计算机. 服务等, 甚至可以包括人. 组织和概念[BernersLee 1998].在Web体系结构中, ...
随机推荐
- 教你一招:在PowerPoint中自定义可输入文本的占位符
日常生活中,当我们设计多媒体课件时,默认的版式其实已经够用了.但是,很多时候,我们需要更加个性一点,所以,我们需要自定义很多东西.本文介绍在PowerPoint中自定义可输入文本的占位符. 一.占位符 ...
- Thinking in java学习笔记之set
Random rand = new Random(47); Set<Integer> set = new HashSet<Integer>(); for(int i=0;i&l ...
- python 中文乱码问题2
1.文件存为utf-8的格式,windows和linux两个环境都可以用 2.中文输出可以采用u方法 比如:print u'成年'
- springMVC文件上传
参考的地址:http://www.tuicool.com/articles/nMVjaiF 1.需要使用的jar. commons-fileupload.jar与commons-io-1.4.jar二 ...
- noi-openjudge[4.7搜索]怀表问题
为啥我觉得这是个DP-.f[i][j][k][l]表示四种零件分别用了i,j,k,l个的方案数.然后发现这样不能保证表一定能接在表链首尾,也不知道状态之间如何转移,那么加一维变成f[i][j][k][ ...
- Zabbix性能优化
前言 如果不做表分区和删除历史数据规则设置的话,随着时间的推移zabbix的查询性能会变得很低 查看zabbix的性能 通过zabbix的NVPS(每秒处理数值数)来衡量其性能,在zabbix的das ...
- 认识和使用NSOperation
原文链接:http://www.jianshu.com/p/2de9c776f226 NSOperation是OC中多线程技术的一种,是对GCD的OC包装.它包含队列(NSOperationQueue ...
- linux之sed用法
参考 http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行 ...
- IBatisNet使用教程
1.是数据持久层,对应.NET方向的有Ibatis.NET,只要用来处理数据库表结构和程序实体之间映射,ado.net是用来处理和数据库直接通信的,取出数据(object,int,string,da ...
- arcgis desktop 10.1 license manager无法启动问题解决
19:44:36 (ARCGIS) Vendor daemon can't talk to lmgrd (License server machine is down or not respondin ...