开发者

HyperJaxb - Any way to exclude xml schemas which are imported in included schemas?

开发者 https://www.devze.com 2023-03-27 08:38 出处:网络
Here\'s my problem: I have two .xsd files,开发者_开发问答 let\'s call them a.xsd andb.xsd. What I want to achieve is to generate all the classes from a.xsd excluding the classes in b.xsd. Now the pro

Here's my problem:

I have two .xsd files,开发者_开发问答 let's call them a.xsd and b.xsd. What I want to achieve is to generate all the classes from a.xsd excluding the classes in b.xsd. Now the problem is, that a.xsd references a type in b.xsd (via a ), so even when excluded, the classes in b.xsd get build. Is there some way around this?


You can't exclude a schema, but you can exclude a schema-derived package.

Please see Ignoring packages:

<jaxb:bindings schemaLocation="schema-ignored.xsd" node="/xsd:schema">
    <jaxb:schemaBindings>
        <jaxb:package name="org.jvnet.hyperjaxb3.ejb.tests.issuesignored"/>
    </jaxb:schemaBindings>
    <hj:ignored-package name="org.jvnet.hyperjaxb3.ejb.tests.issuesignored"/>
</jaxb:bindings>

Since you actually have a reference to a type from b.xsd somewhere in a.xsd you will need to break this reference. You can either ignore this property using hj:ignored or customize it with xjc:dom to make it a DOM element in the Java class.

ps. I'm responding to users@hyperjaxb.java.net faster than to questions on SO.

0

精彩评论

暂无评论...
验证码 换一张
取 消