`
ponlya
  • 浏览: 159760 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Spring3之xsd

阅读更多

2.5

 

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

 

 

3.0

 

	<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:aop="http://www.springframework.org/schema/aop"
		xmlns:tx="http://www.springframework.org/schema/tx"
		xmlns:jdbc="http://www.springframework.org/schema/jdbc"
		xmlns:context="http://www.springframework.org/schema/context"
		xmlns:util="http://www.springframework.org/schema/util"
		xsi:schemaLocation="
	     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
	     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
	     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
	     ">
	......
	</beans>

 

 

 

Spring3中的xsd文件的位置

org.springframework.beans.factory.xml包下

同目录下还有Srping-beans.dtd Srping-beans-2.0.dtd

Srping-beans-2.0.xsd Srping-beans-2.5.xsd Srping-beans-3.0.xsd

Srping-tool-2.0.xsd Srping-tool-2.5.xsd Srping-tool-3.0.xsd

Srping-util-2.0.xsd Srping-util-2.5.xsd Srping-util-3.0.xsd

org.springframework.aop.config.包下

Srping-aop-2.0.xsd Srping-aop-2.5.xsd Srping-aop-3.0.xsd

org.springframework.jdbc.config 包下Srping-jdbc-3.0.xsd

org.springframework.transaction.config.包下

Srping-tx-2.0.xsd Srping-tx-2.5.xsd Srping-tx-3.0.xsd

org.springframework.context.config包下

Srping-context-2.5.xsd Srping-context-3.0.xsd

添加xsd到本地:window - preferences - Myeclipse enterprise - Files and Editors - xml - xml catalog - Add

然后key typeurl,然后在location里导入导入

 

 

 

xsd文件

参考From:http://wenku.baidu.com/view/3b9ff43a580216fc700afd1a.html 

一、xmlns="http://www.springframework.org/schema/beans" 定义当前文档的默认的命名空间.

二、xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   定义命名空间,xsi这个命名空间是w3c定义的,使用它的原因 是下面"xsi:schemaLocation=" 中的schemaLocation属性是在http://www.w3.org/2001/XMLSchema-instance中定义的,所以要使用这个属性,就得引入它所在的命名空间.

三、xsi:schemaLocation="  schemaLocation属性的作用是用于指定名称空间所对应的XMLSchema模式文档在中里.这个属性在前面定义的xsi名称空间中,所以必须在前面加上表示其名称空间的前缀。设置值包括二部分:a)命名空间的URIb)名称空间所标识的XML Schema文件的位置或者URL地址,这二个部分使用空格分隔。

EG:http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd


 


XSD是指XML结构定义 ( XML Schemas Definition )

From:http://zhidao.baidu.com/question/74740740.html ):

XML Schema DTD的替代品。XML Schema语言也就是XSD

XML Schema描述了XML文档的结构。可以用一个指定的XML Schema来验证某个XML文档,以检查该XML文档是否符合其要求。文档设计者可以通过XML Schema指定一个XML文档所允许的结构和内容,并可据此检查一个XML文档是否是有效的。XML Schema本身是一个XML文档,它符合XML语法结构。可以用通用的XML解析器解析它。

  一个XML Schema会定义:文档中出现的元素、文档中出现的属性、子元素、子元素的数量、子元素的顺序、元素是否为空、元素和属性的数据类型、元素或属性的默认和固定值。

  XSDDTD替代者的原因,一是据将来的条件可扩展,二是比DTD丰富和有用,三是用XML书写,四是支持数据类型,五是支持命名空间。

  XSD文件的后缀名为.xsd

  XML Schema的优点:

  1) XML Schema基于XML,没有专门的语法 

  2) XML可以象其他XML文件一样解析和处理 

  3) XML Schema支持一系列的数据类型(intfloatBooleandate

  4) XML Schema提供可扩充的数据模型。 

  5) XML Schema支持综合命名空间 

  6) XML Schema支持属性组。

Xsd可参考:http://bdk82924.iteye.com/blog/721443 

 

分享到:
评论

相关推荐

    spring 4.25版本 xsd文件

    包含 spring-aop.xsd spring-beans.xsd spring-cache.xsd spring-jdbc spring-jms spring-lang 等

    Spring项目的xsd文件大全

    关于Springmvc,SpringBoot,SpringCould项目的xsd文件大全

    spring3.0 xsd文件

    spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件 spring3.0 xsd文件

    spring-context-3.2.xsd

    spring-context-3.2.xsd

    spring5.0的全部xsd文件

    spring5.0的xsd文件,放在本地,免得eclipse从网上下载检测慢

    spring3.0的xsd文件.rar

    spring3.0的xsd文件.rar,网上整理的

    spring-beans-1.3.xsd

    spring-beans-4.3.xsd spring-beans-4.3.xsd spring-beans-4.3.xsd spring-beans-4.3.xsd

    spring-cache.xsd+spring-encache.xsd

    里面有两个xsd文件,springmodules-ehcache和springmodules-cache.xsd。需求:因为有时候在你在xml中用某个标签时,提示错误,有时候就是少了xsd的引入

    spring4.0xsd文件

    Spring默认在启动时是要加载XSD文件来验证xml文件的,所以如果有的时候断网了,或者一些开源软件切换域名,那么就很容易碰到应用启动不了。我记得当时Oracle收购Sun公司时,遇到过这个情况。为了防止这种情况,...

    spring配置文件的xsd约束文件

    内含spring-aop-4.0.xsd、spring-beans-4.0.xsd、spring-context-4.0.xsd、spring-mvc-4.0.xsd、spring-tool-4.0.xsd、spring-tx-4.0.xsd、spring-util-4.0.xsd,在xml中引入相应xsd文件,便可以自动提示

    spring-context.xsd

    spring-context.xsd用于spring DI开发代码提示。用于Java开发。(包含2.5/3.1/3.2版本)

    spring-mvc-3.0.xsd

    spring-mvc-3.0.xsd

    spring-beans-3.0.xsd

    spring-beans-3.0.xsd

    Spring-3.0.xsd

    Spring-3.0.xsd

    spring-aop.xsd

    spring-aop.xsd用于spring aop开发代码提示。用于Java开发。(包含2.5/3.1/3.2版本)

    spring相关的xsd文件

    文件用于spring mvc等项目的开发

    spring-beans-4.2xsd 文件下载

    Spring默认在启动时是要加载XSD文件来验证xml文件的,所以如果有的时候断网了,或者一些开源软件切换域名,那么就很容易碰到应用启动不了。我记得当时Oracle收购Sun公司时,遇到过这个情况。为了防止这种情况,...

Global site tag (gtag.js) - Google Analytics