RadiationRomeo
New Member
I've created an \[code\]AbstractView\[/code\] in order to output some XML to the browser, as follows:\[code\]public abstract class AbstractXmlView extends AbstractView {public AbstractXmlView() { setContentType("application/xml");}@Overrideprotected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { response.setCharacterEncoding("UTF-8"); Document document = new DOMDocument(); document.setXMLEncoding("UTF-8"); buildXmlDocument(model, document, request, response); response.getOutputStream().print(document.asXML());}public abstract void buildXmlDocument(Map<String, Object> model, Document document, HttpServletRequest request, HttpServletResponse response) throws Exception;\[/code\]As you can see, my subclasses would define the \[code\]buildXMLDocument\[/code\] method in order to populate the XML Document that would be actually delivered to the browser, so here's a simplified implementation:\[code\]public class GetXmlContacts extends AbstractXmlView {@Overridepublic void buildXmlDocument(Map<String, Object> model, Document document, HttpServletRequest request, HttpServletResponse response) throws Exception { Element node = document.addElement("node"); node.setText ("I'm unicode