I have this piece of code:
public void generateXML(DynamicForm form) {
        Document doc = XMLParser.createDocument();
        Element root = doc.createElement("root");
        doc.appendChild(root);
        Element node1 = doc.createElement("node1");
        node1.setAttribute("attribute","test");
        node1.appendChild(doc.createTextNode("my value"));
        doc.appendChild(node1);
        Element node2 = doc.createElement("node2");
        node2.setAttribute("attribute","anothertest");
        doc.appendChild(node2);
        System.out.println(doc.toString());
    }
How do I send this document to the client for download without storing it in a directory?