Recursively removes all processing instruction nodes from the subtree. @see #simplify
(Node node)
| 417 | * @see #simplify |
| 418 | */ |
| 419 | static public void removePIs(Node node) { |
| 420 | NodeList children = node.getChildNodes(); |
| 421 | int i = 0; |
| 422 | int len = children.getLength(); |
| 423 | while (i < len) { |
| 424 | Node child = children.item(i); |
| 425 | if (child.hasChildNodes()) { |
| 426 | removePIs(child); |
| 427 | i++; |
| 428 | } else { |
| 429 | if (child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { |
| 430 | node.removeChild(child); |
| 431 | len--; |
| 432 | } else { |
| 433 | i++; |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /** |
| 440 | * Merges adjacent text/cdata nodes, so that there are no |
no test coverage detected