|
Hi
Mik,
I've
wrestled with this one for an age. I refer you to an answer I got on the list
yesterday to my email "easiest way to include arbitrary
xml"....
OutputFormat format = new
OutputFormat(Method.XML, "UTF-8", true);
String[] cdata =
{"html-tag","contents","question","text","feedback"};
format.setCDataElements(cdata);
format.setNonEscapingElements(cdata);
XMLSerializer serializer = new
XMLSerializer(new StringWriter(),format);
ContentHandler handler =
serializer.asContentHandler();
Marshaller marsh = new
Marshaller(handler);
marsh.setValidation(false);
marsh.setMapping(mapping);
marsh.marshal(obj);
Would output your field contents non-escaped. An alternative could be to create a simple FieldHandler public
class CDataFieldHandler extends
AbstractFieldHandler Object value =
PropertyUtils.getProperty(object,fieldName); } Keith and co. please jump in if I am misguided. Regards, Jez
|
- RE: [castor-user] Hinting XML Marshaller to use ![CDATA] ? Jez Nicholson

