-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XSD support in mapper/config XML #1393
Conversation
# Conflicts: # src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java # src/main/java/org/apache/ibatis/parsing/XPathParser.java
# Conflicts: # src/main/java/org/apache/ibatis/builder/xml/XMLMapperEntityResolver.java
I think there would only be a generator impact in your "version Y" when DTD support is removed. Also, the newer code generated for my MyBatis Dynamic SQL library doesn't use XML at all, so no issue there. I'm OK with this change. |
Thanks for the comment, @jeffgbutler ! |
I haven't reviewed this code (sorry) - but I have a question...is it really necessary to have the system property? Can the code be written such that MyBatis will parse the file if either XSD or DTD is used? |
@jeffgbutler , |
I don't have much of an idea. I suppose you could try DTD and if it failed, fall back to XSD. But that seems kind of kludgy. |
I tried that approach, but it wasn't possible to re-read the Reader/InputStream unless we put the entire file content on memory. I then tried to find a lenient way to parse both XML using the same code, but couldn't find any. |
@jeffgbutler , |
I haven't had time to look at it, so don't hold up the release for me. My only idea is as I said above - try it one way and if it fails try it the other way. This would mean reading the file twice, so then I could imagine a property like "preferXsd" which isn't any better. I will say that Spring supports both ways without a property - so it must be possible. Not sure how they do it. |
Thanks for the comment, @jeffgbutler ! The problem is that it is Spring seems to use It would be possible to change MyBatis implementation, but the impact won't be small. @kazuki43zoo , |
@harawata +1 on revert/delay. I'd rather we solve this in a more Spring-like way, but don't need to delay the release for that. |
@harawata @jeffgbutler I agree! |
We try to find a solution that does not require system property switch. We may be able to reuse the XSD files and the most part of the tests.
Reverted. Thank you for the comments! |
XSD support in mapper/config XML
We try to find a solution that does not require system property switch. We may be able to reuse the XSD files and the most part of the tests.
A fix for #1193 .
Mostly @kazuki43zoo 's work. :D
By setting system property
org.mybatis.useXsd
totrue
, users can use XSD instead of DTD when writing mapper/config XML.Migration steps would be....(just an idea)
DTD is deprecated, to use XSD, see ...
to encourage users to migrate to XSD..@jeffgbutler ,
This may affect Generator in some way.
Please let me know if there is any concern.