Dom解析EntityResolver以及mybatis解析xml
EntityResolver 我们都知道,xml一般都有一份声明,是用来规范xml标签语法的,EntityResolver的作用就是自定义验证或者(不验证)这份声明。 xml解析过程中会首先读取声明,然后根据声明的链接去找远程dtd定义,如果网络不好这个过程可能会报错,所以一般我们是将dtd定义放到本地,然后就可以通过注册一个实现了EntityResolver的自定义解析器去解析本地的dtd定义,排除网络影响。 mybatis解析xml也是这样做的 EntityResolver使用 xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> < mapper namespace = " userMapper " > < resultMap id = " personMap " type = " org.apache.ibatis.test.User " > < id property = " id " column = " id " /> < result property = " name " column =