Loading xml srting to jsp

Is it possible to pass a server side xml string to client-side without creating xml file?I created a doc and converted it to an xml string using the function getStringFromDocument(Document doc); can i directly pass it to jsp?

You can load data directly from jsp document as


and in some.jsp
<%@ page language=“java” contentType=“text/xml; charset=ISO-8859-1”

    PrintWriter out = response.getWriter();
    out.print(getStringFromDocument(Document doc));

Basically, the client side code request jsp document, which outputs XML string as response.