Thank you for response.
We should forget the word "valid". just say "XML". I will receive a java String that "looks like" xml, and I have to output it as XML. However, we all know that a java String that "looks like" XML is not actually XML. It has to be encoded as XML in order for the response to be streamed back to the client as XML. If I return it as a java String that "looks like" XML, an XML parser will not be able to parse it as XML.
Is that any clearer? Is there a way to transform this java String that "looks like" XML to XML encoded output before I send it in the response from my JAX-RS based web service?
In this current JAX-RS web service, this java String currently is actually wrappered in java objects that get serialized (thanks to JAX-RS/JAXB) to XML. However, once this XML-wrappered-java-String gets processed by the XML parser on the client, the parser successfully parses the XML wrapper part, and then recognizes the String part for what it is; a java String.
I hope this is clearer. I would be grateful for any and all ideas for how to solve my problem!