Since there is no answer so far, let me be more precise about my problem. I
have to deal with three xsd schemata: A, B, and C. Each schema is associated
with a different namespace. Both B and C <xs:import> schema A and extend
type definitions from A. Thus, A basically provides abstract type
definitions which are extended in B and C. JAXB perfectly maps all three
schemata to Java classes.
Valid XML instance documents may contain elements from B and C, but there
may also be valid instance documents just containing elements from B or C.
Now the problem (question): If I just instantiate classes from B and
marshall them to XML, then the JAXB marshaller also puts the namespace
declaration for schema C into my root element. However, since my instance
document does not contain elements from C I do not want that namespace to be
declared automatically. Is there any possibility to make the JAXB marshaller
suppress the namespace declaration for C?
I would appreciate a quick "yes" or "no" response because I urgently need
the answer in one of my projects. If, however, it is not possible, I would
like to put this onto my wish list for the upcoming JAXB version.
Regards,
Claus
Claus Nagel wrote:
>
> Hi all -
>
> Is there a possibility to customize the JAXB marshaller to suppress
> namespace declarations on the root element? Sometimes an instance document
> does not contain elements from a certain namespace so I do not want that
> namespace to be declared at the root element.
>
> Thanks,
> Claus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
--
View this message in context: http://www.nabble.com/Suppress-namespace-declarations-tp19096906p19643907.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.