Re: How to set Woodstox output properties ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: How to set Woodstox output properties ?

I have found the answer myself. First you need create your own version of an
XMLOutputFactory [1]. Here's what I do: package package;
public class MyXMLOutputFactory extends WstxOutputFactory { public
AvenueXMLOutputFactory() { super();
SetProperty(WstxOutputProperties.P_OUTPUT_INVALID_CHAR_HANDLER, new
InvalidCharHandler.ReplacingHandler(' ')); } } Then comes the next problem.
Had to look into JDK code for this one: What determines which
XMLOutputFactory that JAX-WS uses? Well, it turns out this can be overridden
by the use of a System Property, namely
"System.setProperty("". As you may have
quessed there's an equivalent one for XMLInputFactory but in this posting
we're only concerned with the XML output part. I like best to set the System
Property programmatically
""); but you can of course also do it from
command line. That is all. Works as expected for my part. You can use the
same method to change other configuration properties for Woodstox and thereby
change how JAX-WS's default XML encoder/decoder works.



[Message sent by forum member 'phans33']

View Post: