users@jaxb.java.net

Re: [Fwd: Re: Need advise on JAXB namespace prefix retaining issue.]

From: Dmitri Colebatch <dim_at_colebatch.com>
Date: Tue, 13 Mar 2007 16:32:17 +1100

Hi,

Please look at https://jaxb.dev.java.net/guide/ - specifically
https://jaxb.dev.java.net/guide/Changing_prefixes.html

cheers
dim

On 3/13/07, karthick.dharmarajan <Karthick.Dharmarajan_at_sun.com> wrote:
> Forwarding again this mail after subscribing to users_at_jaxb.dev.java.net
> alias
>
>
> ---------- Forwarded message ----------
> From: "karthick.dharmarajan" <Karthick.Dharmarajan_at_Sun.COM>
> To: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
> Date: Tue, 13 Mar 2007 10:08:52 +0530
> Subject: Re: Need advise on JAXB namespace prefix retaining issue.
> Hi Kohsuke,
>
> Thanks for your input.I know about NamespacePrefixMapper but as you know
> I want to preserve my existing prefix so I haven't used it.As you
> suggest I shall try out doing it programmatically using StAX.
>
> Including users_at_jaxb.dev.java.net for any further advise.
>
> -Karthick
>
> Kohsuke Kawaguchi wrote:
>
> >
> > Feel free to send in JAXB related questions to
> > users_at_jaxb.dev.java.net. That is where the JAXB team monitors.
> >
> > karthick.dharmarajan wrote:
> >
> >> JAXB does not retain the namespace prefix during Marshalling.Can some
> >> one please clarify how to retain the namespace prefix in the
> >> Marshalled XML file as if what is defined in the original xml file.
> >
> >
> > There's no way to retain the original namespace prefix bindings
> > intact. But there are other ways.
> >
> > For example, if your application knows what prefixes it wants to use
> > for what namespaces (which is often the case, since you are doing
> > databinding), then you can use NamespacePrefixMapper.
> >
> > Or you can use StAX to peek all the namespace declarations at the root
> > element, remember that in a map, then use that to drive
> > NamespacePrefixMapper at marshal time. This ends up preserving the
> > namespace declarations as long as they are on the root element.
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>