This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
 First, you can use the overload of Marshaller marshal method to marshal to SAXResult instance. In the SAXResult instance, you supply the fully implemented ContentHandler with the functionality of which being to produce an xml document serialized output faithfully reproduces what marshalling results. That ContentHandler say XTSHandler or whatever named. In this Handler, it may be provisioned with the escaping on angle brackets and ampersand. In that case, if the marshalling output does contain embedded xml into string, it would indeed produce undesired output, semantically incorrect.
[1.1] The easier approach would be to develop the characters method to write out <![CDATA[ and ]]> to wrap around the characters stream when it detects the existence of angle brackets and ampersand in the character stream. In fact, this would be done. The way to detect the tell-tale characters can be done with a simple regex Pattern (see also in ).
 The harder way and more versatile way to further extension is to subclass the XTSHandler, say, by further implementing LexicalHandler interface. It is this that I want to show the layout. I suppose simpler case to writing out with System.out. If you use a writer, that is a bit more involved but not too much involved.
[2.1] Say such handler be XTSHandler_CDATA. It could consist of these elements.
[2.2] This should be working amid still a lot of space to develop into sophistication. But I prefer commensurate complexity to match the complexity of the problem to handle. The marshaller then marshal the object to the SAXResult instance with the ContentHandler being XDTHandler_CDATA (choose a better name, I just coin it like this for the layout in this illustration.)
 There sure are other approaches as well such as more beefed up implementation of jaxb existing in the Eclipse endorsed projects. Another more elementary way I can conceive off-hand as well is to piping the Result to a transformation xslt custom-made with specific element(s) being output as CDATA Section. But the latter is of more restricted scope of usefulness as it needs to know beforehand which elements' text content should be output as CDATA...