protected void write(Document node) throws ShellException { isXML11 = "1.1".equals(getVersion(node)); //$NON-NLS-1$ if (isXML11) { printWriter.println("<?xml version=\"1.1\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } else { printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } printWriter.flush(); write(node.getDoctype()); write(node.getDocumentElement()); }
/** Normalizes and prints the given string. */ protected void normalizeAndPrint(String s, boolean isAttValue) { int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); normalizeAndPrint(c, isAttValue); } }
protected void write(Element node) throws ShellException { printWriter.print('<'); printWriter.print(node.getNodeName()); Attr[] attrs = sortAttributes(node.getAttributes()); for (Attr attr : attrs) { printWriter.print(' '); printWriter.print(attr.getNodeName()); printWriter.print("=\""); //$NON-NLS-1$ normalizeAndPrint(attr.getNodeValue(), true); printWriter.print('"'); } if (node.getChildNodes().getLength() == 0) { printWriter.print(" />"); //$NON-NLS-1$ printWriter.flush(); } else { printWriter.print('>'); printWriter.flush(); Node child = node.getFirstChild(); while (child != null) { writeAnyNode(child); child = child.getNextSibling(); } printWriter.print("</"); //$NON-NLS-1$ printWriter.print(node.getNodeName()); printWriter.print('>'); printWriter.flush(); } }
public synchronized String toString(Document document) throws ShellException { StringWriter sw = new StringWriter(); printWriter = new PrintWriter(sw); write(document); String s = sw.toString(); return s; }
protected void write(Element node) throws ShellException { printWriter.print('<'); printWriter.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (Attr attr : attrs) { printWriter.print(' '); printWriter.print(attr.getNodeName()); printWriter.print("=\""); //$NON-NLS-1$ normalizeAndPrint(attr.getNodeValue(), true); printWriter.print('"'); } if (node.getChildNodes().getLength() == 0) { printWriter.print(" />"); //$NON-NLS-1$ printWriter.flush(); } else { printWriter.print('>'); printWriter.flush(); Node child = node.getFirstChild(); while (child != null) { writeAnyNode(child); child = child.getNextSibling(); } printWriter.print("</"); //$NON-NLS-1$ printWriter.print(node.getNodeName()); printWriter.print('>'); printWriter.flush(); } }
public synchronized String toString(Document document) throws ShellException { StringWriter sw = new StringWriter(); printWriter = new PrintWriter(sw); write(document); String s = sw.toString(); return s; }
protected void write(Element node) throws ShellException { printWriter.print('<'); printWriter.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (Attr attr : attrs) { printWriter.print(' '); printWriter.print(attr.getNodeName()); printWriter.print("=\""); //$NON-NLS-1$ normalizeAndPrint(attr.getNodeValue(), true); printWriter.print('"'); } if (node.getChildNodes().getLength() == 0) { printWriter.print(" />"); //$NON-NLS-1$ printWriter.flush(); } else { printWriter.print('>'); printWriter.flush(); Node child = node.getFirstChild(); while (child != null) { writeAnyNode(child); child = child.getNextSibling(); } printWriter.print("</"); //$NON-NLS-1$ printWriter.print(node.getNodeName()); printWriter.print('>'); printWriter.flush(); } }
protected void write(Document node) throws ShellException { isXML11 = "1.1".equals(getVersion(node)); //$NON-NLS-1$ if (isXML11) { printWriter.println("<?xml version=\"1.1\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } else { printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } printWriter.flush(); write(node.getDoctype()); write(node.getDocumentElement()); }
protected void normalizeAndPrint(String s, boolean isAttValue) { int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); normalizeAndPrint(c, isAttValue); } }
public synchronized String toString(Document document) throws ShellException { StringWriter sw = new StringWriter(); printWriter = new PrintWriter(sw); write(document); String s = sw.toString(); return s; }
protected void write(Element node) throws ShellException { printWriter.print('<'); printWriter.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (Attr attr : attrs) { printWriter.print(' '); printWriter.print(attr.getNodeName()); printWriter.print("=\""); //$NON-NLS-1$ normalizeAndPrint(attr.getNodeValue(), true); printWriter.print('"'); } if (node.getChildNodes().getLength() == 0) { printWriter.print(" />"); //$NON-NLS-1$ printWriter.flush(); } else { printWriter.print('>'); printWriter.flush(); Node child = node.getFirstChild(); while (child != null) { writeAnyNode(child); child = child.getNextSibling(); } printWriter.print("</"); //$NON-NLS-1$ printWriter.print(node.getNodeName()); printWriter.print('>'); printWriter.flush(); } }
protected void write(Document node) throws ShellException { isXML11 = "1.1".equals(getVersion(node)); //$NON-NLS-1$ if (isXML11) { printWriter.println("<?xml version=\"1.1\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } else { printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } printWriter.flush(); write(node.getDoctype()); write(node.getDocumentElement()); }
/** Normalizes and prints the given string. */ protected void normalizeAndPrint(String s, boolean isAttValue) { int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); normalizeAndPrint(c, isAttValue); } }
public synchronized String toString(Document document) throws ShellException { StringWriter sw = new StringWriter(); printWriter = new PrintWriter(sw); write(document); String s = sw.toString(); return s; }
protected void write(Document node) throws ShellException { isXML11 = "1.1".equals(getVersion(node)); //$NON-NLS-1$ if (isXML11) { printWriter.println("<?xml version=\"1.1\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } else { printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ } printWriter.flush(); write(node.getDoctype()); write(node.getDocumentElement()); }
/** Normalizes and prints the given string. */ protected void normalizeAndPrint(String s, boolean isAttValue) { int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char c = s.charAt(i); normalizeAndPrint(c, isAttValue); } }