1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// BeanIO fixedlenght unmarshallers
Unmarshaller unmarshallerCheck = bioFactory.createUnmarshaller("ct6InFLTransform");
Object record = unmarshallerCheck.unmarshal(line);
// Castor xml marshaller
String encoding = "UTF-8";
StringWriter sw = new StringWriter();
org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(sw);
marshaller.setEncoding(encoding);
marshaller.setMapping(this.castorMapping);
marshaller.marshal(record);
=> J'utilise le framework Castor pour "convertir" un bean en un flux XML que je place dans un StringWriter....éventuellement caster en String
String result = sw.toString();
=> Par la suite, je vais récupérer plusieurs variables du même type que result et donc je voudrais les fusionner. |
Partager