users@jaxb.java.net

Re: Re: Re: marshalling

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 26 Jun 2009 07:50:49 +0200

On 6/26/09, Lulseged Zerfu <lulseged.zerfu_at_ericsson.com> wrote:
> Hi
>
> Using what you have suggested removes everything <?xml version="1.0"
> encoding="UTF-8" standalone="yes"?>. What I wanted to remove was only
> part of it <?xml version="1.0" encoding="UTF-8"?>. That's is remove
> standalone="yes".
>
> marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
>

This is what I wrote - please note the second line.

| marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
|
| Write the <?xml...> as you want to the writer of your XML. <<< ! >>>
|
| marshaller.marshal(...)


>
> I have solved the second one by using a namespaceprefix.
>
> marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new
> CustomNameSpacePrefixMapper());
>
> The CustomNameSpacePrefixMapper extends
> com.sun.xml.bind.marshaller.NamespacePrefixMapper and implements one
> special method where you can specify which namespace to include:
> .

Excellent.

-W