网站首页 > 知识剖析 正文
xml名称空间
一个xml文档中可以包含多个元素和属性,在文档中使用多个DTD文件时,可能会碰到相同的元素,而这些名称相同的元素可能代表了完全不同的含义,为了防止命名冲突,W3C提供了一个推荐标准-XML名称空间
名称空间有两种声明形式
第一种形式
<元素名 xmls:prefixname="URI">
元素名是指在哪个元素上声明名称空间,prefixname表示名称空间前缀的名字
例:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/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
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>
第二种形式
<元素名 xmlns="URI">
<!-- 在该ml中表示所有没有前缀的元素都属于http://www.springframework.org/schema/beans所标识的名称空间 -->
<beans xmlns="http://www.springframework.org/schema/beans"></beans>
- 上一篇: Spring自动装配之xml例子
- 下一篇: Spring的AOP示例之xml方式
猜你喜欢
- 2024-11-23 Spring中源码中涉及的「设计模式」知多少?
- 2024-11-23 spring阅读--容器及实例化
- 2024-11-23 Java教程:学会写Starter-你就懂了SpringBoot自动配置
- 2024-11-23 SpringBoot学习笔记三之表述层
- 2024-11-23 如何使用Java API操作HDFS系统?
- 2024-11-23 Spring IOC容器XML配置示例
- 2024-11-23 xml 配置文件规范 校验
- 2024-11-23 阿里P7大神,Java学习之路-IO流与XML,超赞分享
- 2024-11-23 Java基础教程:dubbo源码解析-服务暴露与发现
- 2024-11-23 解决springboot的pom.xml文件第一行报错问题
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)