`
gaozhonghui
  • 浏览: 237867 次
  • 性别: Icon_minigender_1
  • 来自: 内蒙古自治区
社区版块
存档分类
最新评论

applicationContext 中 xmlns 与 xsi:schemaLocation 含义

阅读更多
<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.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

在 XML 实例文档中有时会发现有 schemaLocation 属性。很多人对此非常疑惑,搞不清这个属性究竟是什么意思,究竟该如何使用。 schemaLocation 属性用来引用(schema)模式文档,解析器可以在需要的情况下使用这个文档对 XML 实例文档进行校验。它的值(URI)是成对出现的,第一个值表示命名空间,第二个值则表示描述该命名空间的模式文档的具体位置,两个值之间以空格分隔。当然,在必要情况下,可以为 schemaLocation 属性指派多个这样的值对。
4
2
分享到:
评论
2 楼 Mydwr 2012-01-13  
依然迷惑不解
1 楼 buyajun 2010-11-16  
xml解析时,如何 得到 这些 多个值对呢?
用dom4j 解析时,用
  String nameSpaceUri = aEle.getNamespaceURI();
  String nameSpacePrefix=aEle.getNamespacePrefix();
只能得到 一个

如果:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <soapenv:Body>

只能得到 xmlns:soapenv

而 xmlns:xsd 和xmlns:xsi 如何 得到了?

有没有 类似 aEle.getNamespacePrefix(); 但 返回一个 数组的 呢??

相关推荐

    springmvc笔记

    新建或拷贝applicationContext.xml &lt;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" ...

    struts hibernate spring 集成时使用依赖注解的方式的秘籍

    //applicationContext.xml文件中添加 &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...

    DOS命令使用方法(超全).

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;!-- 下边这是加入spring配置 --&gt; &lt;param-name&gt;contextConfigLocation &lt;param-value&gt;...

    spring-influxdb-orm:Spring InfluxDB ORM

    " http://www.springframework.org/schema/beans " xmlns : xsi = " http://www.w3.org/2001/XMLSchema-instance " xmlns : influxdb = " http://www.vgerbot.com/schema/influxdb " xsi : schemaLocation = ...

    springweb3.0MVC注解(附实例)

    web.xml 中定义了一个名为 annomvc 的 Spring MVC 模块,按照 Spring MVC 的契约,需要在 WEB-INF/annomvc-servlet.xml 配置文件中定义 Spring MVC 模块的具体配置。annomvc-servlet.xml 的配置内容如下所示: ...

    生活轨迹SSH服务端

    -- &lt;param-value&gt;/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml&lt;/param-value&gt; --&gt; &lt;param-value&gt;classpath:beans.xml &lt;filter-name&gt;struts2 &lt;filter-class&gt;org.apache.struts2...

    ssh 整合的实例-----员工表的增删查改

    applicationContext.xml &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p...

    spring aop 实现源代码--xml and annotation(带lib包)

    interceptorNames则指定了应用与指定接口上的Advices对象列表,spring将根据列表中定义的顺序在执行目标对象的方法前、后执行Advice中定义的方法。 现在我们写一个程序来验证下: java 代码 1. package ...

    spring applicationContext 配置文件

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

    Spring AOP配置源码

    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 ...

    基于EXT SSI的简单树实现

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;welcome-file&gt;page/index.jsp &lt;!-- web应用启动时初始化applicationContext --&gt; ...

    spring_MVC源码

    弃用了struts,用spring mvc框架做了几个项目,感觉都不错,而且使用了注解方式,可以省掉一大堆配置文件。本文主要介绍使用注解方式配置的spring mvc,之前写的spring3.0 mvc和rest小例子...02.&lt;web-app xmlns:xsi=...

    客户关系管理系统框架搭建(二)

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

    Spring MVC 入门实例

    在 Spring MVC 中, jsp 文件中尽量不要有 Java 代码, 只有 HTML 代码和"迭代(forEach)"与"判断(if)"两个jstl标签. jsp 文件只作为渲染(或称为视图 View)模板使用. 好了, 我们开始吧. 首先我们需要一个放在 WEB-INF...

    JdbcTemplateTool.zip

     xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;   name="dataSource" class=...

    springmybatis

    查询出列表,也就是返回list, 在我们这个例子中也就是 List&lt;User&gt; , 这种方式返回数据,需要在User.xml 里面配置返回的类型 resultMap, 注意不是 resultType, 而这个resultMap 所对应的应该是我们自己配置的 ...

Global site tag (gtag.js) - Google Analytics