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

applicationContext 中 xmlns 与 xsi:schemaLocation 含义

XML 
阅读更多
<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(); 但 返回一个 数组的 呢??

相关推荐

Global site tag (gtag.js) - Google Analytics