从cXML dtd文件生成Java类

时间:2019-05-24 11:22:26

标签: java exception dtd cxml

我已经从cxml org下载了cXML.dtd文件,并尝试使用java world中给出的以下命令来生成Java类

xjc -dtd -d C:\Users\mansari7\Downloads\cxml\cXML_DTDs\cXML\1.2.042\generatedsrc -p com.ge.hc.healthcareb2bpunchoutaddon.cxml.jaxb cXML.dtd

但是我遇到的问题是该属性重复。下面是错误。

parsing a schema...
[ERROR] Property "Name" is already defined. Use <jaxb:property> to resolve this conflict.
line 586 of file:/C:/Users/mansari7/Downloads/cxml/cXML_DTDs/cXML/1.2.042/InvoiceDetail.dtd

如果我重命名属性,我将得到 parsing a schema... compiling a schema... Exception in thread "main" java.lang.IllegalArgumentException: trying to create the same field twice: value at com.sun.codemodel.internal.JDefinedClass.field(JDefinedClass.java:410) at com.sun.codemodel.internal.JDefinedClass.field(JDefinedClass.java:381) at com.sun.tools.internal.xjc.generator.bean.field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:61) at com.sun.tools.internal.xjc.generator.bean.field.SingleField.<init>(SingleField.java:79) at com.sun.tools.internal.xjc.generator.bean.field.SingleField.<init>(SingleField.java:66) at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.sun.tools.internal.xjc.generator.bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java:54) at com.sun.tools.internal.xjc.generator.bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java:67) at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java:762) at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:543) at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:246) at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:154) at com.sun.tools.internal.xjc.model.Model.generateCode(Model.java:275) at com.sun.tools.internal.xjc.Driver.run(Driver.java:348) at com.sun.tools.internal.xjc.Driver.run(Driver.java:185) at com.sun.tools.internal.xjc.Driver._main(Driver.java:108) at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:65) at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:88)

0 个答案:

没有答案