-
Notifications
You must be signed in to change notification settings - Fork 64
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
xmlbeans supports Chinese tags to generate java source code and build JAR package #15
base: REL_5_1_1
Are you sure you want to change the base?
Conversation
…ly, javac on the win platform does not support Chinese source code paths)] 1.Add two command line parameters to control whether to use the new encoding method to generate Java source code and build the JAR package. 2.Add properties in the options to support the above changes. 3.During compilation, select different generation logic by checking whether the "usecustom" and "useshortname" parameters are present. 4.Add in-code unit tests for verification.
I'll have a fuller look another time - maybe next week. I would prefer if the encoding param was the name of the encoding to use. I would suggest a name of |
@@ -107,6 +107,7 @@ public enum XmlOptionsKeys { | |||
SAVE_CDATA_LENGTH_THRESHOLD, | |||
SAVE_CDATA_ENTITY_COUNT_THRESHOLD, | |||
SAVE_SAX_NO_NSDECLS_IN_ATTRIBUTES, | |||
SAVE_EXTRENAMESPACES, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be SAVE_EXTRA_NAMESPACES
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right,I will fix it.
OK,Thank you, and I look forward to your prompt response. |
return setCompileSourceCodeEncoding (true); | ||
} | ||
|
||
public XmlOptions setCompileSourceCodeEncoding (boolean b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my suggestion was that the input should be a string - the name of an encoding, eg "utf-8"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll fix it tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created #16 - this is just an initial change, needs more work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created #16 - this is just an initial change, needs more work
Maybe you have the wrong branch? My changes are based on branch REL_5_1_1 instead of trunk, but your PR#16 is based on trunk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code using all your changes and added the ones I missed before, is there anything else I need to modify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing these changes is hard. XMLBeans does't have great support for testing the code generation support.
If you can build this yourself and see if it does the job for you then that's great.
I will try to get #16 merged at some stage - but only when I have time to build and test it.
I am omitting some of your changes (like extra namespaces) because I would prefer to do separate PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I will upload it to a separate PR soon,and for the version #16 I will test it tomorrow when I go to work👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjfanning I just fixed a small problem and then used the jar with the command line parameters "-sourcecodeencoding UTF-8 -usejavashortname" to test my project. The build was successful and the unit tests passed completely. It will be fine after you apply my commit.(:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spotted that issue independently and already have a fix in #16
2. Supplement changes missed in PR: xmlbeans adds an interface for saving xmlobject objects to zip. Add saveExtraNamespaces input parameter in xmlbeans, and modify the top-level element writing to disk to ensure that the top-level element can write extraNamespaces.
[Reason: xmlbeans-REL_5_1_1 does not support Chinese paths (essentially, javac on the win platform does not support Chinese source code paths)]
1.Add two command line parameters to control whether to use the new encoding method to generate Java source code and build the JAR package.
2.Add properties in the options to support the above changes.
3.During compilation, select different generation logic by checking whether the "usecustom" and "useshortname" parameters are present.
4.Add in-code unit tests for verification.