users@jaxb.java.net

package _at_XmlSchema(namespace="value") annotation ignored in package-info.java

From: Sean Reque <seanthenewt_at_yahoo.com>
Date: Mon, 18 May 2009 08:40:27 -0700 (PDT)

I am using JAXB 2.1.2. When I place an @XmlSchema annotation in package-info.java specifying a namespace, the annotation seems to be ignored by the schemagen ant task. If I instead annotate the package declaration directly in a source file, schemagen will actually place the element declaration corresponding to the source class in the right namespace, but not the type declaration. Schemagen will instead create two schema files, one for the specified namespace, and one for the default namespace. The first will contain an import of the second and will contain the element declaration, and the second file will contain the type declaration. Of course, the source file will no longer compile, as it is illegal to put package annotations in a source file.

What I would like to do is make one annotation for a package that specifies a namespace and have all element, type, and attribute declarations that are generated for that package to be placed in the specified namespace by default. Is there a way to do this?