mybatis / mybatipse

Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Eclipse Public License 1.0
332 stars 91 forks source link

custom dtd location not supported #110

Closed OverDrone closed 2 years ago

OverDrone commented 2 years ago

Hello! I'm behind firewall and I don't have access to internet resources like http://mybatis.org/dtd/mybatis-3-mapper.dtd I've changed all my mybatis xml files to other internal location: <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://internalhost:port/url/mybatis-3-mapper.dtd"> And after those changes this plugin stopped working completely, says Content Assist not available at current location. I had to add xml mapping rule (which needs to be performed now on every developer eclipse instance), without this action xml content assist would stop working. Please make this plugin work even if I specified custom location for .dtd file

harawata commented 2 years ago

Hello @OverDrone ,

In Eclipse, you should add a custom 'XML Catalog' to solve that issue. The following setting assumes that the mybatis project is imported to your workspace, but it would also be possible to specify the DTD file in the file system.

image

FYI, at runtime, MyBatis reads the DTD in its JAR and does not access the URL.

OverDrone commented 2 years ago

In Eclipse, you should add a custom 'XML Catalog' to solve that issue.

I wouldn't say it's a solution because it must be done on each developer IDE of my team. I frankly don't understand why you even bother checking dtd location because you have ID -//mybatis.org//DTD Mapper 3.0//EN to uniquely identify xml file as mybatis mapper. XSD/DTD location was always environment user specific setting, you should never assume any value there. All those XML Catalog settings are mostly for the case when you don't control XML file contents, want to cache some schemas workspace wide, etc.

FYI, at runtime, MyBatis reads the DTD in its JAR and does not access the URL.

Yes, I'm aware but this doesn't help me during development, that's why I installed this plugin in a first place.

OverDrone commented 2 years ago

I did some digging and it seems it's how eclipse plugin system works. Although DTDs references have public ID in them, it's not used by eclipse xml parser for some reason and you can only reference dtd system id in plugin.xml. I don't think I have it in me to ask eclipse team to change plugin.xml format, so you may consider this issue closed and blame hardcode of dtd system id on eclipse.