MCPcopy Create free account
hub / github.com/apache/freemarker / removeComments

Method removeComments

src/main/java/freemarker/ext/dom/NodeModel.java:393–411  ·  view source on GitHub ↗

Recursively removes all comment nodes from the subtree. @see #simplify

(Node node)

Source from the content-addressed store, hash-verified

391 * @see #simplify
392 */
393 static public void removeComments(Node node) {
394 NodeList children = node.getChildNodes();
395 int i = 0;
396 int len = children.getLength();
397 while (i < len) {
398 Node child = children.item(i);
399 if (child.hasChildNodes()) {
400 removeComments(child);
401 i++;
402 } else {
403 if (child.getNodeType() == Node.COMMENT_NODE) {
404 node.removeChild(child);
405 len--;
406 } else {
407 i++;
408 }
409 }
410 }
411 }
412
413 /**
414 * Recursively removes all processing instruction nodes

Callers 1

parseMethod · 0.95

Calls 2

getChildNodesMethod · 0.65
getNodeTypeMethod · 0.65

Tested by

no test coverage detected