public String compose(XhtmlNode node) throws IOException { StringWriter sdst = new StringWriter(); dst = sdst; writeNode("", node, false); return sdst.toString(); }
public void composeDocument(FileOutputStream f, XhtmlNode xhtml) throws IOException { byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; f.write(bom); dst = new OutputStreamWriter(f, "UTF-8"); writeNode("", xhtml, false); dst.flush(); dst.close(); }
public void compose(OutputStream stream, XhtmlNode x) throws IOException { byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; stream.write(bom); dst = new OutputStreamWriter(stream, "UTF-8"); dst.append("<html><head><link rel=\"stylesheet\" href=\"fhir.css\"/></head><body>\r\n"); writeNode("", x, false); dst.append("</body></html>\r\n"); dst.flush(); }
private void composeDoc(XhtmlDocument doc) throws IOException { // headers.... // dst.append("<html>" + (pretty ? "\r\n" : "")); for (XhtmlNode c : doc.getChildNodes()) writeNode(" ", c, false); // dst.append("</html>" + (pretty ? "\r\n" : "")); }
private void writeDocument(String indent, XhtmlNode node) throws IOException { indent = ""; for (XhtmlNode c : node.getChildNodes()) writeNode(indent, c, false); }
private void writeElement(String indent, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (!pretty || noPrettyOverride) indent = ""; // html self closing tags: http://xahlee.info/js/html5_non-closing_tag.html if (node.getChildNodes().size() == 0 && (xml || Utilities.existsInList(node.getName(), "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"))) dst.append(indent + "<" + node.getName() + attributes(node) + "/>" + (pretty && !noPrettyOverride ? "\r\n" : "")); else { boolean act = node.allChildrenAreText(); if (act || !pretty || noPrettyOverride) dst.append(indent + "<" + node.getName() + attributes(node)+">"); else dst.append(indent + "<" + node.getName() + attributes(node) + ">\r\n"); if (node.getName() == "head" && node.getElement("meta") == null) dst.append(indent + " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>" + (pretty && !noPrettyOverride ? "\r\n" : "")); for (XhtmlNode c : node.getChildNodes()) writeNode(indent + " ", c, noPrettyOverride || node.isNoPretty()); if (act) dst.append("</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); else if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text) dst.append((pretty && !noPrettyOverride ? "\r\n"+ indent : "") + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); else dst.append(indent + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); } }
public String compose(XhtmlNode node) throws IOException { StringWriter sdst = new StringWriter(); dst = sdst; writeNode("", node, false); return sdst.toString(); }
public void compose(OutputStream stream, XhtmlNode x) throws IOException { byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; stream.write(bom); dst = new OutputStreamWriter(stream, "UTF-8"); dst.append("<html><head><link rel=\"stylesheet\" href=\"fhir.css\"/></head><body>\r\n"); writeNode("", x, false); dst.append("</body></html>\r\n"); dst.flush(); }
public void composeDocument(FileOutputStream f, XhtmlNode xhtml) throws IOException { byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; f.write(bom); dst = new OutputStreamWriter(f, "UTF-8"); writeNode("", xhtml, false); dst.flush(); dst.close(); }
private void composeDoc(XhtmlDocument doc) throws IOException { // headers.... // dst.append("<html>" + (pretty ? "\r\n" : "")); for (XhtmlNode c : doc.getChildNodes()) writeNode(" ", c, false); // dst.append("</html>" + (pretty ? "\r\n" : "")); }
private void writeDocument(String indent, XhtmlNode node) throws IOException { indent = ""; for (XhtmlNode c : node.getChildNodes()) writeNode(indent, c, false); }
private void writeElement(String indent, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (!pretty || noPrettyOverride) indent = ""; // html self closing tags: http://xahlee.info/js/html5_non-closing_tag.html if (node.getChildNodes().size() == 0 && (xml || Utilities.existsInList(node.getName(), "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"))) dst.append(indent + "<" + node.getName() + attributes(node) + "/>" + (pretty && !noPrettyOverride ? "\r\n" : "")); else { boolean act = node.allChildrenAreText(); if (act || !pretty || noPrettyOverride) dst.append(indent + "<" + node.getName() + attributes(node)+">"); else dst.append(indent + "<" + node.getName() + attributes(node) + ">\r\n"); if (node.getName() == "head" && node.getElement("meta") == null) dst.append(indent + " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>" + (pretty && !noPrettyOverride ? "\r\n" : "")); for (XhtmlNode c : node.getChildNodes()) writeNode(indent + " ", c, noPrettyOverride || node.isNoPretty()); if (act) dst.append("</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); else if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text) dst.append((pretty && !noPrettyOverride ? "\r\n"+ indent : "") + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); else dst.append(indent + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : "")); } }