简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM