You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kiren Pillay <ki...@gmail.com> on 2015/08/03 14:55:28 UTC

UnMarshalling illegal characters from XML

Hi

Which is the most efficient way of removing illegal characters from the
JAXB XML Output for a JAX-RS service?

I have data values that have 0x00 which does get marshalled,  however the
client falls over because of this. I want to prevent these values from
being written to the JAXB Output stream.

Regards
Kiren

Re: UnMarshalling illegal characters from XML

Posted by Kiren Pillay <ki...@gmail.com>.
Hi Sergey,James,

The application is quite old now, so CDATA is not an option since the
client may need to change.

I think writing a custom XMLStreamWriter may fit the purpose.

Thanks
Kiren

On Mon, Aug 3, 2015 at 11:36 PM, James Hutton <ja...@gmail.com>
wrote:

> I've had to deal with this and the only way I could see was to extend the
> jaxws/jaxb front-end and basically filter the output. Only works with two
> of the four writers.
> On Aug 3, 2015 4:34 PM, "Sergey Beryozkin" <sb...@gmail.com> wrote:
>
> > Hi Kiren
> > Can using CData blocks help ?
> > Another option is to use a Stax transformation feature and drop some
> > simple elements that may have the illegal values:
> >
> >
> >
> http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Droppingoutputandinputelements
> >
> > Finally you can register a custom XMLStreamWriter and do a more
> > fine-grained control...
> >
> > HTH, Sergey
> >
> > On 03/08/15 13:55, Kiren Pillay wrote:
> >
> >> Hi
> >>
> >> Which is the most efficient way of removing illegal characters from the
> >> JAXB XML Output for a JAX-RS service?
> >>
> >> I have data values that have 0x00 which does get marshalled,  however
> the
> >> client falls over because of this. I want to prevent these values from
> >> being written to the JAXB Output stream.
> >>
> >> Regards
> >> Kiren
> >>
> >>
> >
>

Re: UnMarshalling illegal characters from XML

Posted by James Hutton <ja...@gmail.com>.
I've had to deal with this and the only way I could see was to extend the
jaxws/jaxb front-end and basically filter the output. Only works with two
of the four writers.
On Aug 3, 2015 4:34 PM, "Sergey Beryozkin" <sb...@gmail.com> wrote:

> Hi Kiren
> Can using CData blocks help ?
> Another option is to use a Stax transformation feature and drop some
> simple elements that may have the illegal values:
>
>
> http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Droppingoutputandinputelements
>
> Finally you can register a custom XMLStreamWriter and do a more
> fine-grained control...
>
> HTH, Sergey
>
> On 03/08/15 13:55, Kiren Pillay wrote:
>
>> Hi
>>
>> Which is the most efficient way of removing illegal characters from the
>> JAXB XML Output for a JAX-RS service?
>>
>> I have data values that have 0x00 which does get marshalled,  however the
>> client falls over because of this. I want to prevent these values from
>> being written to the JAXB Output stream.
>>
>> Regards
>> Kiren
>>
>>
>

Re: UnMarshalling illegal characters from XML

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Kiren
Can using CData blocks help ?
Another option is to use a Stax transformation feature and drop some 
simple elements that may have the illegal values:

http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Droppingoutputandinputelements

Finally you can register a custom XMLStreamWriter and do a more 
fine-grained control...

HTH, Sergey

On 03/08/15 13:55, Kiren Pillay wrote:
> Hi
>
> Which is the most efficient way of removing illegal characters from the
> JAXB XML Output for a JAX-RS service?
>
> I have data values that have 0x00 which does get marshalled,  however the
> client falls over because of this. I want to prevent these values from
> being written to the JAXB Output stream.
>
> Regards
> Kiren
>