ByteArrayOutputStream source = new ByteArrayOutputStream();
BufferedOutputStream buffer = new BufferedOutputStream(source);
try {
marshaller.marshal(node, buffer);
buffer.flush();
LineIterator iterator = IOUtil.lineIterator(new ByteArrayInputStream(source.toByteArray()), "UTF-8");
LinkedList<String> contents = new LinkedList<String>();
while (iterator.hasNext()) {
String each = iterator.next().trim();
if (!each.isEmpty()) {
contents.add(each);
}
}
return contents;