users@jaxb.java.net

Re: Duplicated namespace declaration from output xml

From: Colin Fleming <colin.mailinglist_at_gmail.com>
Date: Tue, 18 Nov 2008 13:01:18 +0100

Hi all,

Sorry for the late response, I just saw this.

For a slightly less foul solution, consider marshalling through a
TransformerHandler, and using SAX to filter the namespace events you don't
want. It's still pretty ugly, but it works for us.

Cheers,
Colin

2008/10/22 Wolfgang Laun <wolfgang.laun_at_gmail.com>

> I'm aware that I'm suggesting a terrible hack, wrought with ifs and buts,
> so don't tell me.
>
> To effect certain local modifications on the marshalled text you could do
> the following:
>
> Call marshal with a PipedOutputStream pos as its second parameter. Connect
> a PipedInputStream pis to that and start a thread reading from pis,
> accumulating characters into a StringBuffer. At certain positions (e.g.atline ends, after requesting JAXB_FORMATTED_OUTPUT) delete strings such as
> xmlns:xs="..." from the StringBuffer and emit the StringBuffer to the
> ultimate destination for your marhalled text. Insert is, of course, possible
> as well, assuming you can identify the position.
>
>
>
> On Tue, Oct 21, 2008 at 6:25 PM, Son Nguyen <sontrang91_at_gmail.com> wrote:
>
>>
>>
>> I think the problem comes from the xs:anySimpleType. If I change it to
>> string, it will works as normal. It also make sense that jaxb create
>> output
>> with types for anySimpleType element. However, it will be a lot nicer if
>> jaxb can group all the xml declaration on the top and just use the nametag
>> for it. Do you know a way to tell jaxb to do that?
>>
>> Attachment is the complete project for you to run.
>>
>> Thanks,
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Duplicated-namespace-declaration-from-output-xml-tp20069914p20094153.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>