Recursively removes all comment nodes from the subtree. @see #simplify
(Node node)
| 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 |
no test coverage detected