public void print(boolean hasChildNode) { PrintWriter pr = new PrintWriter(System.out); output(pr, 0, hasChildNode); pr.flush(); }
public void output(PrintWriter ps, int indentLevel, boolean hasChildNode) { String indentString = getIndentLevelString(indentLevel); String name = getName(); String value = getValue(); if (hasNodes() == false || hasChildNode == false) { ps.print(indentString + "<" + name); outputAttributes(ps); // Thnaks for Tho Beisch (11/09/04) if (value == null || value.length() == 0) { // Not using the short notation <node /> because it cause compatibility trouble ps.println("></" + name + ">"); } else { ps.println(">" + XML.escapeXMLChars(value) + "</" + name + ">"); } return; } ps.print(indentString + "<" + name); outputAttributes(ps); ps.println(">"); int nChildNodes = getNNodes(); for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true); } ps.println(indentString +"</" + name + ">"); }
public void output(PrintWriter ps, int indentLevel, boolean hasChildNode) { String indentString = getIndentLevelString(indentLevel); String name = getName(); String value = getValue(); if (hasNodes() == false || hasChildNode == false) { ps.print(indentString + "<" + name); outputAttributes(ps); // Thnaks for Tho Beisch (11/09/04) if (value == null || value.length() == 0) { // Not using the short notation <node /> because it cause compatibility trouble ps.println("></" + name + ">"); } else { ps.println(">" + XML.escapeXMLChars(value) + "</" + name + ">"); } return; } ps.print(indentString + "<" + name); outputAttributes(ps); ps.println(">"); int nChildNodes = getNNodes(); for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true); } ps.println(indentString +"</" + name + ">"); }
public String toString(String enc, boolean hasChildNode) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); PrintWriter pr = new PrintWriter(byteOut); output(pr, 0, hasChildNode); pr.flush(); try { if (enc != null && 0 < enc.length()) return byteOut.toString(enc); } catch (UnsupportedEncodingException e) { } return byteOut.toString(); }
public void output(PrintWriter ps, int indentLevel, boolean hasChildNode) { String indentString = getIndentLevelString(indentLevel); String name = getName(); String value = getValue(); if (hasNodes() == false || hasChildNode == false) { ps.print(indentString + "<" + name); outputAttributes(ps); // Thnaks for Tho Beisch (11/09/04) if (value == null || value.length() == 0) { // Not using the short notation <node /> because it cause compatibility trouble ps.println("></" + name + ">"); } else { ps.println(">" + XML.escapeXMLChars(value) + "</" + name + ">"); } return; } ps.print(indentString + "<" + name); outputAttributes(ps); ps.println(">"); int nChildNodes = getNNodes(); for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true); } ps.println(indentString +"</" + name + ">"); }
public void print(boolean hasChildNode) { PrintWriter pr = new PrintWriter(System.out); output(pr, 0, hasChildNode); pr.flush(); }
public void print(boolean hasChildNode) { PrintWriter pr = new PrintWriter(System.out); output(pr, 0, hasChildNode); pr.flush(); }
public String toString(String enc, boolean hasChildNode) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); PrintWriter pr = new PrintWriter(byteOut); output(pr, 0, hasChildNode); pr.flush(); try { if (enc != null && 0 < enc.length()) return byteOut.toString(enc); } catch (UnsupportedEncodingException e) { } return byteOut.toString(); }
public String toString(String enc, boolean hasChildNode) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); PrintWriter pr = new PrintWriter(byteOut); output(pr, 0, hasChildNode); pr.flush(); try { if (enc != null && 0 < enc.length()) return byteOut.toString(enc); } catch (UnsupportedEncodingException e) { } return byteOut.toString(); }
for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true);
for (int n=0; n<nChildNodes; n++) { Node cnode = getNode(n); cnode.output(ps, indentLevel+1, true);