文書全体をストリームする方法を見つけましたが、ファイルを大きすぎるとメモリの問題が発生しないようにノードごとにノードをストリームする方法がありますか?ノードごとにストリームXMLノード
private Document document;
private void stream(OutputStream out) {
// write the doc into stream
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer;
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(out);
try {
transformer = transformerFactory.newTransformer();
transformer.transform(source, result);
} catch (TransformerException e) {
throw new RuntimeException("couldn't stream result to output");
}
}