private static boolean isEmpty(final DomElement element) { for (DomNode n = element.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof DomElement || n instanceof DomText) { return false; } } return true; }
private static boolean isEmpty(final DomElement element) { for (DomNode n = element.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof DomElement || n instanceof DomText) { return false; } } return true; }
protected void printXml(final DomElement node) throws IOException { if (!isExcluded(node)) { final boolean hasChildren = node.getFirstChild() != null; builder_.append(indent_).append('<'); printOpeningTag(node); if (!hasChildren && !node.isEmptyXmlTagExpanded()) { builder_.append("/>").append('\n'); } else { builder_.append(">").append('\n'); for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { indent_.append(" "); if (child instanceof DomElement) { printXml((DomElement) child); } else { builder_.append(child); } indent_.setLength(indent_.length() - 2); } builder_.append(indent_).append("</").append(node.getTagName()).append('>').append('\n'); } } }
protected void printXml(final DomElement node) { if (!isExcluded(node)) { final boolean hasChildren = node.getFirstChild() != null; buffer_.append(indent_).append('<'); printOpeningTag(node); if (!hasChildren && !isEmptyXmlTagExpanded(node)) { buffer_.append("/>").append('\n'); } else { buffer_.append(">").append('\n'); for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { indent_.append(" "); if (child instanceof DomElement) { printXml((DomElement) child); } else { buffer_.append(child); } indent_.setLength(indent_.length() - 2); } buffer_.append(indent_).append("</").append(node.getTagName()).append('>').append('\n'); } } }
protected void printXml(final DomElement node) { if (!isExcluded(node)) { final boolean hasChildren = node.getFirstChild() != null; buffer_.append(indent_).append('<'); printOpeningTag(node); if (!hasChildren && !isEmptyXmlTagExpanded(node)) { buffer_.append("/>").append('\n'); } else { buffer_.append(">").append('\n'); for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { indent_.append(" "); if (child instanceof DomElement) { printXml((DomElement) child); } else { buffer_.append(child); } indent_.setLength(indent_.length() - 2); } buffer_.append(indent_).append("</").append(node.getTagName()).append('>').append('\n'); } } }
protected void printXml(final DomElement node) throws IOException { if (!isExcluded(node)) { final boolean hasChildren = node.getFirstChild() != null; builder_.append(indent_).append('<'); printOpeningTag(node); if (!hasChildren && !node.isEmptyXmlTagExpanded()) { builder_.append("/>").append('\n'); } else { builder_.append('>').append('\n'); for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { indent_.append(" "); if (child instanceof DomElement) { printXml((DomElement) child); } else { builder_.append(child); } indent_.setLength(indent_.length() - 2); } builder_.append(indent_).append("</").append(node.getTagName()).append('>').append('\n'); } } }
protected void printXml(final DomElement node) { if (!isExcluded(node)) { final boolean hasChildren = node.getFirstChild() != null; buffer_.append(indent_).append('<'); printOpeningTag(node); if (!hasChildren && !isEmptyXmlTagExpanded(node)) { buffer_.append("/>").append('\n'); } else { buffer_.append(">").append('\n'); for (DomNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) { indent_.append(" "); if (child instanceof DomElement) { printXml((DomElement) child); } else { buffer_.append(child); } indent_.setLength(indent_.length() - 2); } buffer_.append(indent_).append("</").append(node.getTagName()).append('>').append('\n'); } } }
/** * Recursively write the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { final boolean hasChildren = getFirstChild() != null; printWriter.print(indent + "<"); printOpeningTagContentAsXml(printWriter); if (hasChildren || isEmptyXmlTagExpanded()) { printWriter.print(">\r\n"); printChildrenAsXml(indent, printWriter); printWriter.print(indent); printWriter.print("</"); printWriter.print(getTagName()); printWriter.print(">\r\n"); } else { printWriter.print("/>\r\n"); } }
/** * Recursively write the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { final boolean hasChildren = getFirstChild() != null; printWriter.print(indent + "<"); printOpeningTagContentAsXml(printWriter); if (hasChildren || isEmptyXmlTagExpanded()) { printWriter.print(">\r\n"); printChildrenAsXml(indent, printWriter); printWriter.print(indent); printWriter.print("</"); printWriter.print(getTagName()); printWriter.print(">\r\n"); } else { printWriter.print("/>\r\n"); } }
/** * Recursively write the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { final boolean hasChildren = (getFirstChild() != null); printWriter.print(indent + "<"); printOpeningTagContentAsXml(printWriter); if (!hasChildren && !isEmptyXmlTagExpanded()) { printWriter.println("/>"); } else { printWriter.println(">"); printChildrenAsXml(indent, printWriter); printWriter.println(indent + "</" + getTagName() + ">"); } }
/** * Recursively write the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { final boolean hasChildren = (getFirstChild() != null); printWriter.print(indent + "<"); printOpeningTagContentAsXml(printWriter); if (!hasChildren && !isEmptyXmlTagExpanded()) { printWriter.println("/>"); } else { printWriter.println(">"); printChildrenAsXml(indent, printWriter); printWriter.println(indent + "</" + getTagName() + ">"); } }
/** * Recursively write the XML data for the node tree starting at <code>node</code>. * * @param indent white space to indent child nodes * @param printWriter writer where child nodes are written */ @Override protected void printXml(final String indent, final PrintWriter printWriter) { final boolean hasChildren = (getFirstChild() != null); printWriter.print(indent + "<"); printOpeningTagContentAsXml(printWriter); if (!hasChildren && !isEmptyXmlTagExpanded()) { printWriter.println("/>"); } else { printWriter.println(">"); printChildrenAsXml(indent, printWriter); printWriter.println(indent + "</" + getTagName() + ">"); } }
else if (element.getFirstChild() != null) {
else if (element.getFirstChild() != null) {