Closed karlmdavis closed 6 years ago
The general idea is that the plugin considers it a user error if a namespace prefix is mapped to two different namespace URIs. Translated to a XSD schema specification, two different prefixes for the same URI would translate to something like:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:prefix="http://www.jguru.se/some/uri" xmlns:prefix="http://www.jguru.se/some/other/uri" ... >
While we should care to ensure that we only emit that Exception when a namespace prefix/URI (i.e. key/value) is being changed, I believe it should be considered a user error. Within a JAXB compilation unit, namespace prefix/URI mappings should be stable.
Closing as a user error.
I've got a package like the following:
This breaks schemagen. Initially, I was seeing errors like the following:
... but I figured out that those errors were just due to bad error handling code in the plugin. (That error handling problem has been fixed, per #32, but the fix hasn't been released yet.)
I had to debug the plugin in Eclipse to find the real problem. I was having trouble getting a stack trace from Eclipse, but
org.codehaus.mojo.jaxb2.schemageneration.postprocessing.schemaenhancement.SimpleNamespaceResolver:211
is the real error that was being hidden:As a workaround, this error goes away if I remove the
xmlns
property (the prefix binding) from my package's@XmlSchema
annotation. I guess the plugin was written before JAXB added official support for prefix mapping?