-
Notifications
You must be signed in to change notification settings - Fork 65
Comments
Conversation
whatever098
commented
Jun 25, 2024
This modification is due to the issue that when the XSD file contains Chinese labels, the generated paths include Chinese characters, causing the JAR file to fail execution. Therefore, Java short names are used to avoid this problem.
pjfanning
commented
Jul 6, 2024
@whatever098 I took your uof.xsd from #18 (comment) and I was able to get scomp to build classes and a jar for the xsd.
Used this command:
bin/scomp -sourcecodeencoding utf-8 -src mysrc uof.xsd
I built XMLBeans using the latest trunk code.
I don't see a need for this PR.
whatever098
commented
Jul 8, 2024
@pjfanning More precisely, the reason is that we expect to generate the alias of the tag as the name of the xsbs in the jar, rather than the tag name. there is not any problem in the usage of you command, but the generated jar uses Chinese names as xsb's names. So this will cause the xsb to not be found at runtime.
Take uof.xsd as an example. When shortjavaname is not used, the generated jar will look like this:
屏幕截图 2024年07月08日 154421
pjfanning
commented
Jul 8, 2024
I tested the jar I generated and was able to use it ok with no issues.
package org.example;
import cn.org.nits.uof3.zhCn.x2021.uof.用户类型;
public class Main {
public static void main(String[] args) {
用户类型 o1 = 用户类型.Factory.newInstance();
用户类型.文档标识0004 o2 = o1.addNew文档标识0004();
o2.set标识符B6EC("标识符B6EC");
System.out.println(o1);
}
}
whatever098
commented
Jul 8, 2024
I tested the jar I generated and was able to use it ok with no issues.
package org.example; import cn.org.nits.uof3.zhCn.x2021.uof.用户类型; public class Main { public static void main(String[] args) { 用户类型 o1 = 用户类型.Factory.newInstance(); 用户类型.文档标识0004 o2 = o1.addNew文档标识0004(); o2.set标识符B6EC("标识符B6EC"); System.out.println(o1); } }
Are you running in Windows or Linux?
pjfanning
commented
Jul 8, 2024
I tested the jar I generated and was able to use it ok with no issues.
package org.example; import cn.org.nits.uof3.zhCn.x2021.uof.用户类型; public class Main { public static void main(String[] args) { 用户类型 o1 = 用户类型.Factory.newInstance(); 用户类型.文档标识0004 o2 = o1.addNew文档标识0004(); o2.set标识符B6EC("标识符B6EC"); System.out.println(o1); } }Are you running in Windows or Linux?
Macbook.
@pjfanning I am now using the trunk branch to test some xsd on my computer. I did not find any problems, but the above problem existed when I used xmlbeans-5.1.1 before. It should be that there are some related fixes for this problem in the trunk. In this case, this PR is unnecessary and you can close it immediately. Thank you for your help.
Uh oh!
There was an error while loading. Please reload this page.
see #15
The source code encoding param was added separately using #16
fyi @whatever098 - would you be able to provide a detailed description of what problem you have (with examples) and how this code solves it?