|
1 | 1 | /*
|
2 |
| - * Copyright 2009-2012 the original author or authors. |
| 2 | + * Copyright 2009-2014 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -35,45 +35,45 @@ public class XMLMapperEntityResolver implements EntityResolver {
|
35 | 35 |
|
36 | 36 | private static final Map<String, String> doctypeMap = new HashMap<String, String>();
|
37 | 37 |
|
38 |
| - private static final String IBATIS_CONFIG_DOCTYPE = "-//ibatis.apache.org//DTD Config 3.0//EN".toUpperCase(Locale.ENGLISH); |
39 |
| - private static final String IBATIS_CONFIG_URL = "http://ibatis.apache.org/dtd/ibatis-3-config.dtd".toUpperCase(Locale.ENGLISH); |
| 38 | + private static final String IBATIS_CONFIG_PUBLIC = "-//ibatis.apache.org//DTD Config 3.0//EN".toUpperCase(Locale.ENGLISH); |
| 39 | + private static final String IBATIS_CONFIG_SYSTEM = "http://ibatis.apache.org/dtd/ibatis-3-config.dtd".toUpperCase(Locale.ENGLISH); |
40 | 40 |
|
41 |
| - private static final String IBATIS_MAPPER_DOCTYPE = "-//ibatis.apache.org//DTD Mapper 3.0//EN".toUpperCase(Locale.ENGLISH); |
42 |
| - private static final String IBATIS_MAPPER_URL = "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd".toUpperCase(Locale.ENGLISH); |
| 41 | + private static final String IBATIS_MAPPER_PUBLIC = "-//ibatis.apache.org//DTD Mapper 3.0//EN".toUpperCase(Locale.ENGLISH); |
| 42 | + private static final String IBATIS_MAPPER_SYSTEM = "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd".toUpperCase(Locale.ENGLISH); |
43 | 43 |
|
44 |
| - private static final String MYBATIS_CONFIG_DOCTYPE = "-//mybatis.org//DTD Config 3.0//EN".toUpperCase(Locale.ENGLISH); |
45 |
| - private static final String MYBATIS_CONFIG_URL = "http://mybatis.org/dtd/mybatis-3-config.dtd".toUpperCase(Locale.ENGLISH); |
| 44 | + private static final String MYBATIS_CONFIG_PUBLIC = "-//mybatis.org//DTD Config 3.0//EN".toUpperCase(Locale.ENGLISH); |
| 45 | + private static final String MYBATIS_CONFIG_SYSTEM = "http://mybatis.org/dtd/mybatis-3-config.dtd".toUpperCase(Locale.ENGLISH); |
46 | 46 |
|
47 |
| - private static final String MYBATIS_MAPPER_DOCTYPE = "-//mybatis.org//DTD Mapper 3.0//EN".toUpperCase(Locale.ENGLISH); |
48 |
| - private static final String MYBATIS_MAPPER_URL = "http://mybatis.org/dtd/mybatis-3-mapper.dtd".toUpperCase(Locale.ENGLISH); |
| 47 | + private static final String MYBATIS_MAPPER_PUBLIC = "-//mybatis.org//DTD Mapper 3.0//EN".toUpperCase(Locale.ENGLISH); |
| 48 | + private static final String MYBATIS_MAPPER_SYSTEM = "http://mybatis.org/dtd/mybatis-3-mapper.dtd".toUpperCase(Locale.ENGLISH); |
49 | 49 |
|
50 |
| - private static final String IBATIS_CONFIG_DTD = "org/apache/ibatis/builder/xml/mybatis-3-config.dtd"; |
51 |
| - private static final String IBATIS_MAPPER_DTD = "org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd"; |
| 50 | + private static final String MYBATIS_CONFIG_DTD = "org/apache/ibatis/builder/xml/mybatis-3-config.dtd"; |
| 51 | + private static final String MYBATIS_MAPPER_DTD = "org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd"; |
52 | 52 |
|
53 | 53 | static {
|
54 |
| - doctypeMap.put(IBATIS_CONFIG_URL, IBATIS_CONFIG_DTD); |
55 |
| - doctypeMap.put(IBATIS_CONFIG_DOCTYPE, IBATIS_CONFIG_DTD); |
| 54 | + doctypeMap.put(IBATIS_CONFIG_SYSTEM, MYBATIS_CONFIG_DTD); |
| 55 | + doctypeMap.put(IBATIS_CONFIG_PUBLIC, MYBATIS_CONFIG_DTD); |
56 | 56 |
|
57 |
| - doctypeMap.put(IBATIS_MAPPER_URL, IBATIS_MAPPER_DTD); |
58 |
| - doctypeMap.put(IBATIS_MAPPER_DOCTYPE, IBATIS_MAPPER_DTD); |
| 57 | + doctypeMap.put(IBATIS_MAPPER_SYSTEM, MYBATIS_MAPPER_DTD); |
| 58 | + doctypeMap.put(IBATIS_MAPPER_PUBLIC, MYBATIS_MAPPER_DTD); |
59 | 59 |
|
60 |
| - doctypeMap.put(MYBATIS_CONFIG_URL, IBATIS_CONFIG_DTD); |
61 |
| - doctypeMap.put(MYBATIS_CONFIG_DOCTYPE, IBATIS_CONFIG_DTD); |
| 60 | + doctypeMap.put(MYBATIS_CONFIG_SYSTEM, MYBATIS_CONFIG_DTD); |
| 61 | + doctypeMap.put(MYBATIS_CONFIG_PUBLIC, MYBATIS_CONFIG_DTD); |
62 | 62 |
|
63 |
| - doctypeMap.put(MYBATIS_MAPPER_URL, IBATIS_MAPPER_DTD); |
64 |
| - doctypeMap.put(MYBATIS_MAPPER_DOCTYPE, IBATIS_MAPPER_DTD); |
| 63 | + doctypeMap.put(MYBATIS_MAPPER_SYSTEM, MYBATIS_MAPPER_DTD); |
| 64 | + doctypeMap.put(MYBATIS_MAPPER_PUBLIC, MYBATIS_MAPPER_DTD); |
65 | 65 | }
|
66 | 66 |
|
67 | 67 | /*
|
68 | 68 | * Converts a public DTD into a local one
|
69 |
| - * |
70 |
| - * @param publicId Unused but required by EntityResolver interface |
71 |
| - * @param systemId The DTD that is being requested |
| 69 | + * |
| 70 | + * @param publicId The public id that is what comes after "PUBLIC" |
| 71 | + * @param systemId The system id that is what comes after the public id. |
72 | 72 | * @return The InputSource for the DTD
|
| 73 | + * |
73 | 74 | * @throws org.xml.sax.SAXException If anything goes wrong
|
74 | 75 | */
|
75 |
| - public InputSource resolveEntity(String publicId, String systemId) |
76 |
| - throws SAXException { |
| 76 | + public InputSource resolveEntity(String publicId, String systemId) throws SAXException { |
77 | 77 |
|
78 | 78 | if (publicId != null) publicId = publicId.toUpperCase(Locale.ENGLISH);
|
79 | 79 | if (systemId != null) systemId = systemId.toUpperCase(Locale.ENGLISH);
|
|
0 commit comments