Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xjc to generate packages from the xsd file <jxb:package name="example.test"/> #42

Open
deepres opened this issue Nov 18, 2015 · 1 comment

Comments

@deepres
Copy link

deepres commented Nov 18, 2015

It seems I cannot leave the generatePackage empty because my sources will land in the generated package.

According to the docs:
https://jaxb.java.net/2.2.4/docs/xjc.html

Here under Compiler restrictions they claim that if you won't set the -p attribute the next choice is to look the xsd file, but I guess it's not happening. Can you tell me how I can accomplish that task ?

Example file

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
           jxb:version="2.0"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           jxb:extensionBindingPrefixes="xjc">
  <xs:annotation>
    <xs:appinfo>
      <jxb:globalBindings>
        <xjc:simple />
      </jxb:globalBindings>
      <jxb:schemaBindings>
        <jxb:package name="com.custom.package"/>
      </jxb:schemaBindings>
    </xs:appinfo>
  </xs:annotation>
</xs:schema>
@scubacabra
Copy link
Owner

I'm actually not real sure anymore. It has been so long since I worked with xsd's. I've also never used the jxb:globalBindings like you use here.

I know I never personally used generatePackage because I always specified the package in every xsd and it worked for me before.

You could try setting the generatePackage whatever you have in the jxb:package. That might work. If you are looking to set them in xmlns you can check out the really simple xsd's in the examples folder of this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants