Forwarding again this mail after subscribing to users_at_jaxb.dev.java.net
alias
attached mail follows:
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.
>