How to validate xsd schema if it includes ohter schemas?

156 views Asked by At

I want to use xjc tool for genrating classes from xsd file.

But I cought foloowing exception:

$ xjc -d generated POCD_MT000040.xsd
parsing a schema...
compiling a schema...
Exception in thread "main" java.lang.IllegalArgumentException: trying to create the same field twice: id
        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:62)
        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.GeneratedConstructorAccessor10.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        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:759)
        at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:540)
        at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:243)
        at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:151)
        at com.sun.tools.internal.xjc.model.Model.generateCode(Model.java:275)
        at com.sun.tools.internal.xjc.Driver.run(Driver.java:342)
        at com.sun.tools.internal.xjc.Driver.run(Driver.java:184)
        at com.sun.tools.internal.xjc.Driver._main(Driver.java:107)
        at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:64)
        at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:87)

I tried to calidate this schema at online validator but it includes three others schemas:

<xs:include schemaLocation="coreschemas/datatypes.xsd"/>
<xs:include schemaLocation="coreschemas/voc.xsd"/>
<xs:include schemaLocation="coreschemas/NarrativeBlock.xsd"/>

And fails with bunch of errors.

And now I don't know how to generate classes from this schema?

And how does validate it now?
Any suggestions?

0

There are 0 answers