users@jaxb.java.net

RE: xmlns:ns2 and friends

From: Ernst, Matthias <matthias.ernst_at_coremedia.com>
Date: Tue, 14 Nov 2006 07:35:59 +0100

Johnny,

You can implement a NamespacePrefixMapper and set it as a property
(I think the key is com.sun.xml.bind.namespacePrefixMapper) on the Marshaller.

Kohsuke, can you make those constants public? I understand they're not part
of the JAXB API, but of the RI, but I hate copying those strings out of the
RI impl classes.

Best
Matthias


-----Original Message-----
From: Johnny Tolliver [mailto:jxt_at_ornl.gov]
Sent: Mon 11/13/2006 22:45
To: users_at_jaxb.dev.java.net
Subject: xmlns:ns2 and friends
 
This is certainly a newbie question, maybe even an RTFM question, but a real
quick look didn't reveal the answer.

When I build JAXB objects that use multiple namespaces and marshal them into
XML, the resulting XML defines namespace abbreviations like xmlns:ns2. If I
used more namespaces, they would surely be ns3, ns4, etc. Is there any way
to get the abbreviations to be the names I want rather than those arbitrary
names? Thanks.