编写好XSD文件,然后来看怎么使用XSD文件校验,并解析SqlMapper文件,也就是实现doParseSqlMapperResourceWithSchema()方法。

为了实现这个功能,有两个基本要求:

(1)兼容性:需要兼容mybatis的原生配置,兼容有两种层级,一种是使用DTD校验,这个前面已经说了,走原来的流程,兼容性没有问题;另一种就是走XSD校验,但也需要兼容mybatis原生配置,这种兼容性一方面从上面修改的XSD文件去保证,另一方面也需要从XML的解析去保证。

(2)扩展性:修改的目的就是为了扩展性,所以扩展性也是一个基本要求。但是扩展性不是随意性,也需要按照规范来扩展,这个规范就是自定义的XSD文件。

为了达到这两个基本要求,下面是我的一种思路,主要借鉴于Spring的自定义命名空间:

1、创建一个EntityResolver,读取类路径下指定模式的配置文件,比如:"classpath*:**/dysd-*-namespaces.ini"

2、在ini文件中定义命名空间元信息,如:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtwAAADICAIAAABUE6GaAAAYlUlEQVR4nO2dUbLjOI5Fvez89KJqNb2CjO6filnAaD7elFtJEpcASEmUdU4gMiwRBEFST7ymnPbr7z/597/+k7a///57+3Zef708dnWaq1MPUWjQoiOcmBFnFeYaAGAir2VFSWLhD1XJiYm9j+c1NFlflPhrfdxQqAAAgywtSvyHngjCp5AUYkVhp2QcS1CGqof8pyhacUl0swUAAA+IErXCzWoFPlhrvFPVRXek/AIo8byGywMAYC55UfLr169fv351Rcl+1YlldrAoyb0JPn+n5Mt2X5rz6Jzc3C6FJ7iWGtY17Nlg+5qJAwA4gYwo+ciRo0XJ4MLvX7Gs/ZJ13gp/zdqWEyWfGa+vAUtNNpVBdxhDe2aW+ECUAADkGHp80xUlaUVSV+ke+m0fISdKztkj8WRyO5oTJ3z8AlS4WfOrc+uWIkoAAObyJaLEE6FZ2vy3KzKi76eLd/aWw2YvrtZa3q3V7Ei98eAv1ZGLZJrBm4dHL+RHx0SUAACMc5QoGd9IOFmUNEXD+E5Jd2PAuSsg1n5L7nQPRU+7pZ7cLMFhjZiQsHUV/3UVuvD8M6v71f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h5t9120Fs8cUYJhGJYwRMlzLbctv0jOK2d+Wnq6ocVHCcMwrDZECYZhGIZhSxiiBMMwDMOwJewQUQIAAAAQBVECAAAAS4AoAQAAgCVAlAAAAMASIEoAAABgCRAlAAAAsASIEgAAAFgCRAkAAAAsAaIEAAAAlgBRAgAAAEuAKAEAAIAlQJQAAADAEvwfuLiPkHIuYdkAAAAASUVORK5CYII=" alt="" />

使用命名空间作为Section的名称,下面的schema、parser分别表示命名空间的xsd文件和解析器实现类,这样就可以根据XML中的XSD命名空间找到校验文件,并且有一个解析入口了。

说明:

  1. apache的commons-configuration提供了ini格式文件的读取API
  2. Spring中使用META-INF/spring.schemas和META-INF/spring.handlers来存储XSD文件和解析器实现类,这里我修改为使用ini文件集中配置
  3. 因为读取的是所有类路径下满足通配符的ini文件,因此可以非常简单的扩展其它命名空间,至于在Java中具体怎么使用XSD来校验,这里就不细说了

我把XML的解析分解为三要素:解析上下文、解析器、被解析文件。doParseSqlMapperResourceWithSchema()方法也很简洁:

protected void doParseSqlMapperResourceWithSchema(Configuration configuration, Resource mapperLocation){
ISqlMapperParserContext context = new SqlMapperParserContext(configuration);
XmlParserUtils.parseXml(context, mapperLocation);
}

解析器接口如下:

public interface IParser<E extends IParserContext> {
public void parse(E parserContext, String location);
public void parse(E parserContext, String[] locationPatterns);
public void parse(E parserContext, InputStream inputStream);
public void parse(E parserContext, Resource resource);
}

解析上下文和解析器实现类又依次分为三个层级:

(1)通用解析上下文:

public interface IParserContext {
public ProblemReporter getProblemReporter();
public EventListener getEventListener();
public SourceExtractor getSourceExtractor();
public Environment getEnvironment();
}

相应层级的解析器实现类主要负责加载被解析文件(比如将字符串通配符加载为Resource对象集合),保证不重复解析,保证可并发执行等。

(2)XML解析上下文

public interface IXmlParserContext extends IParserContext{
public boolean isNamespaceAware();
public DocumentLoader getDocumentLoader();
public EntityResolver getEntityResolver();
public ErrorHandler getErrorHandler();
public XmlParserDelegate getDelegate();
}

相应层级的解析器实现类主要负责将Resource转换为Document对象,并在转换的过程中进行校验。

(3)SqlMapper解析上下文

public interface ISqlMapperParserContext extends IXmlParserContext{
public Configuration getConfiguration();
}

相应层级的解析器实现类主要负责查找根元素所在命名空间的解析器,并使用解析器对Document进行解析。

最终,将解析委托给ini配置文件中的SchemaSqlMapperNamespaceParser类,但是因为这个类需要在文本文件中配置,不方便有参数的构造函数,因而进一步委托给SchemaSqlMapperParserDelegate:

public class SchemaSqlMapperNamespaceParser implements INamespaceParser<ISqlMapperParserContext> {

    @Override
public void init() { } @Override
public void parse(ISqlMapperParserContext parserContext, Document document, Resource resource) {
SchemaSqlMapperParserDelegate delegate = new SchemaSqlMapperParserDelegate(parserContext, document, resource);
delegate.parse();
} @Override
public void destory() { }
}

至此,XSD校验已经完成,也已经找到XML解析入口,后续就是在SchemaSqlMapperParserDelegate中真正的解析了。

使用XSD校验Mybatis的SqlMapper配置文件(2)的更多相关文章

  1. 使用XSD校验Mybatis的SqlMapper配置文件(1)

    这篇文章以前面对SqlSessionFactoryBean的重构为基础,先简单回顾一下做了哪些操作: 新建SqlSessionFactoryBean,初始代码和mybatis-spring相同: 重构 ...

  2. Mybatis中SqlMapper配置的扩展与应用(3)

    隔了两周,首先回顾一下,在Mybatis中的SqlMapper配置文件中引入的几个扩展机制: 1.引入SQL配置函数,简化配置.屏蔽DB底层差异性 2.引入自定义命名空间,允许自定义语句级元素.脚本级 ...

  3. 优化与扩展Mybatis的SqlMapper解析

    接上一篇博文,这一篇来讲述怎么实现SchemaSqlMapperParserDelegate——解析SqlMapper配置文件. 要想实现SqlMapper文件的解析,还需要仔细分析一下mybatis ...

  4. Mybatis中SqlMapper配置的扩展与应用(1)

    奋斗了好几个晚上调试程序,写了好几篇博客,终于建立起了Mybatis配置的扩展机制.虽然扩展机制是重要的,然而如果没有真正实用的扩展功能,那也至少是不那么鼓舞人心的,这篇博客就来举几个扩展的例子. 这 ...

  5. mybatis源码配置文件解析之二:解析settings标签

    在前边的博客中分析了mybatis解析properties标签,<mybatis源码配置文件解析之一:解析properties标签>.下面来看解析settings标签的过程. 一.概述 在 ...

  6. mybatis源码配置文件解析之五:解析mappers标签(解析XML映射文件)

    在上篇文章中分析了mybatis解析<mappers>标签,<mybatis源码配置文件解析之五:解析mappers标签>重点分析了如何解析<mappers>标签中 ...

  7. mybatis 加载配置文件的方法

    一.  使用sqlSessionFactory 的 mapperLocations 进行加载 <!-- SessionFactory --> <bean id="sqlSe ...

  8. MyBatis 创建核心配置文件和 SQL 映射文件

    Mybatis 的两个配置文件(mybatis-config.xml  和 xxxMapper.xml)都为 xml 类型,因此在 eclipse 中创建 xml 文件命名为相应的 mybatis-c ...

  9. IDEA中写MyBatis的xml配置文件编译报错的坑

    IDEA中写MyBatis的xml配置文件编译报错的坑 说明:用IDEA编译工具在项目中使用Mybatis框架,编写mybatis-config.xml和Mapper.xml配置文件时,编译项目出现错 ...

随机推荐

  1. 自己封装的一个无限滚动 mark 待传

    @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...

  2. [UCSD白板题] Take as Much Gold as Possible

    Problem Introduction This problem is about implementing an algorithm for the knapsack without repeti ...

  3. 【2016.3.30项目技术记录】]VS2010自动生成MFC单文档框架程序的修改:去除属性框,在CViewTree类中添加鼠标单击响应

    转自http://blog.csdn.net/yanfeiouc2009/archive/2010/06/07/5653360.aspx 手头上有个东西要用到单文档,由于想省事,直接用VS2010做了 ...

  4. 今天自己解决了两个问题(IE10 type slow ChromeDriver erro)

    都是通过google解决的,其实本应该很快解决,可是因自己粗心,大写小错了,加上java基础不过关, "webdriver.chrome.driver"中的webdriver应是全 ...

  5. TextView支持的XML属性及相关方法

    1.android:auyoLink----->setAutoLinkMask(int) ----->是否将符合指定格式的文字转换为可单击的超链接形式 2.android:autoText ...

  6. testMarkDown

    title: git常用命令 date: 2015-10-27 10:28:25 categories: git tags: git 添加 SSH 公钥 Windows 平台中,可以使用 Git Ba ...

  7. [转]全面理解Unity加载和内存管理

    [转]全面理解Unity加载和内存管理 最近一直在和这些内容纠缠,把心得和大家共享一下: Unity里有两种动态加载机制:一是Resources.Load,一是通过AssetBundle,其实两者本质 ...

  8. 蛙蛙推荐:快速自定义Boostrap样式

    现在越来越多的网站使用Bootstrap,相信大家也审美疲劳了,所以我们要用Bootstrap的第一步就是先把顶部的导航栏来自定义一下. 我现在使用的是bootstrap3.0,顶部导航定义如下 &l ...

  9. 在 Cloud 9 中搭建和运行 Go

    简介 自从使用了Chromebook,我脑中一直充斥着在云端开发的念头.在我使用过的位数不多的在线开发环境中,唯有 Cloud 9令我比较满意.实际上,Cloud 9还不支持Go的开发,因此本文我将教 ...

  10. 开始VS 2012中LightSwitch系列的第4部分:太多信息了!使用查询来排序和筛选数据

    [原文发表地址]  Beginning LightSwitch in VS 2012 Part 4: Too much information! Sorting and Filtering Data ...