xml文件格式

xml文件分为文件头和文件体

文件头

文件头:由xml生命和dtd文件类型声明组成。其中dtd文件类型声明是可以省略的。

<?xml version="1.0" encoding="gb2312"?>

文件体

文件体中包含的是文件的内容,xml元素是xml文件的基本单元。
<标记名称 属性名1=“属性值1” 属性名1=“属性值1” ……>内容</标记名称>
常用的文件体
applicationContext.xml(spring)

<?xml version="1.0" encoding="UTF-8"?>
<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" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">

</beans>

mybatis的基础配置文件(mybatisconfig.xml)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//iBATIS.com//DTD SQL Map Config 3.0//EN" "mybatis-3-config.dtd" >
<configuration>

</configuration>

mybatis的mapper文件(mapper.xml)

<?xml version="1.0" encoding="UTF-8" ?>   
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="domain.blog.mappers.AuthorMapper">

</mapper>  

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
    <display-name>ssm-crud</display-name>

</web-app>
    原文作者:@手可摘星辰@
    原文地址: https://blog.csdn.net/qq_38333322/article/details/120588672
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞