eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
202 stars 110 forks source link

Generate @XmlNs annotations on package-info.java #818

Open Tomas-Kraus opened 13 years ago

Tomas-Kraus commented 13 years ago

I'm using xjc to generate a JAXB model from an XSD schema with multiple imported namespaces. I would like to override the default namespace prefixes (ns1, ns2, ...) used by the JAXB marshaller by sensible defaults.

This can be done by setting an xmlns property in the @XmlSchema annotation at package level in package-info.java.

However, this file is generated by xjc by default, without any prefix definitions.

Currently, the only way of overriding this behaviour seems to be:

It would be convenient if the generated package-info.java contained @XmlNs annotations using the prefixes defined in the schema to be compiled, if present. In addition, there should be a mechanism to override the defaults by a suitable xjb customization.

Affected Versions

[2.2.2]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Reported by hwellmann

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented ccu54 said: I got the same issue : I need to generate a package-info.java containing a custom XmlNs prefix, eg. :

@javax.xml.bind.annotation.XmlSchema(
        (...),
        xmlns = {@javax.xml.bind.annotation.XmlNs(prefix = "foo", namespaceURI = "http://mysite.com/xml/foo-v1.0.xsd")},
        (...))
Tomas-Kraus commented 12 years ago

@glassfishrobot Commented silverhawk87 said: I am having the same issue; this would be a great feature to have...

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented puce said: +1 for taking defaults from the XSD and generate the @XmlNs annotations +1 for making this customizable with xjb customization

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Was assigned to snajper

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-818