1 19 package org.openharmonise.rm.publishing.renderers.impl; 20 21 import java.io.*; 22 23 import javax.xml.transform.*; 24 25 import org.openharmonise.commons.xml.*; 26 import org.openharmonise.commons.xml.namespace.*; 27 import org.openharmonise.rm.publishing.renderers.*; 28 29 30 37 public class TextRenderer implements PageRenderer { 38 39 private static XMLPrettyPrint m_xprinter = new XMLPrettyPrint(); 40 41 44 public TextRenderer() { 45 super(); 46 } 47 48 51 public void render(XMLDocument xdoc, Templates templates, OutputStream out) 52 throws RenderException { 53 54 try { 55 PrintStream pstream = new PrintStream(out, true, "UTF-8"); 56 57 pstream.print(m_xprinter.printNode(xdoc.getDocumentElement())); 58 pstream.flush(); 59 } catch (NamespaceClashException e) { 60 throw new RenderException("There was a namespace clash?!", e); 61 } catch (UnsupportedEncodingException e) { 62 throw new RenderException("Unsupported char encoding", e); 63 } 64 65 } 66 67 73 static public void render(XMLDocument xdoc, OutputStream out) 74 throws RenderException { 75 try { 76 PrintStream pstream = new PrintStream(out, true, "UTF-8"); 77 78 pstream.print(m_xprinter.printNode(xdoc.getDocumentElement())); 79 pstream.flush(); 80 } catch (NamespaceClashException e) { 81 throw new RenderException("There was a namespace clash?!", e); 82 } catch (UnsupportedEncodingException e) { 83 throw new RenderException("Unsupported char encoding", e); 84 } 85 86 } 87 88 } 89 | Popular Tags |