Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35424 > unrolled thread

xjb multiple schema bindings with different packages

Started byPhilipp Kraus <philipp.kraus.flashpixx@gmail.com>
First post2016-08-21 12:31 -0700
Last post2016-08-21 12:31 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer


Contents

  xjb multiple schema bindings with different packages Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-08-21 12:31 -0700

#35424 — xjb multiple schema bindings with different packages

FromPhilipp Kraus <philipp.kraus.flashpixx@gmail.com>
Date2016-08-21 12:31 -0700
Subjectxjb multiple schema bindings with different packages
Message-ID<b18bdda2-e426-4d1b-b317-69d30e80f5c4@googlegroups.com>
Hello,

I try to build my first multible schema binding structure of a Jaxb structure. My first experience was only with one XSD, but in my current project I have got many XSD files.

I'm using the Maven plugin

 <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.13.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/xsd</schemaDirectory>
                    <schemaIncludes>
                        <include>**/*.xsd</include>
                    </schemaIncludes>
                    <bindingIncludes>
                        <include>**/*.xjb</include>
                    </bindingIncludes>
                </configuration>
            </plugin>


to translate the XSD to the Java classes and I store the XSD files like this
src/main/xsd/my/package/model.xsd
src/main/xsd/my/package/query.xsd

and the XJB file src/main/xsd/my/package/binding.xjb
The content of the is

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">


    <jaxb:bindings schemaLocation="query.xsd">
        <jaxb:schemaBindings>
            <jaxb:package name="my.package.query"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>

    <jaxb:bindings schemaLocation="model.xsd">
        <jaxb:schemaBindings>
            <jaxb:package name="my.package.model"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>

</jaxb:bindings>


but this does not not work, because of the multiple definition within the same target namespace.
If I remove one of the jaxb:bindings my XSD will be translated, but in this case one file will be translated only.

Can you please explain my, how the configuration of the XJB file must be correct, so that I can use my two XSD files?

Thanks

Phil

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web