users@jaxb.java.net

Re: how to change the the xmlnamspace prefix from "n2" to something like "myPrefix"

From: Andy Davidson <andy_davidson_at_apple.com>
Date: Thu, 27 Jan 2011 10:32:54 -0800

Hi Wolfgang

I am using the version of JAXB bundled into jdk 1.6. I have a lot of trouble with http://jaxb.java.net. I wonder if links have been broken when jaxb got bundled? I have never been able to figure out how to down load the samples. today I down loaded source for 2.0.1. It did not come with documentation or samples :-(

$ pwd
/Users/andrewdavidson/workSpace/AndyScratch/jaxbSRC/jaxb-ri-20060607
$ !find
find . -name vendorProperties.htm -print
$

any idea how I get access to $JAXB_ROOT/docs/vendorProperties.html#prefixmapper. ?

thanks

Andy




On Jan 26, 2011, at 10:56 PM, Wolfgang Laun wrote:

> Namespace prefix mapping is explained step-by-step in the JAXB RI documentation, in
> $JAXB_ROOT/docs/vendorProperties.html#prefixmapper.
>
> This is not a feature of the JAXB specification which means that you base your application on Sun/Oracle's JAXB and run the risk of not being compatible with any other implementation.
>
> -W
>
>
>
> On 27 January 2011 01:43, Andy Davidson <andy_davidson_at_apple.com> wrote:
> Hi
>
> I need to integrate with a legacy system that can not be changed. It requires that my tags have a special prefix to work correctly. Currently the jaxb run time generates a random prefix. something like to "n2". Any idea how I can set the prefix value?
>
> I have seen a couple of example that talk about implementing com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper
> however given the package name is marked "internal" I think this is probably a bad idea
>
> thanks
>
> Andy
>
> p.s. we generate our POJO's using xjc so java annotation are not going to work for us.
>