You are here

public static function PHPUnit_Util_XML::removeCharacterDataNodes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/XML.php \PHPUnit_Util_XML::removeCharacterDataNodes()

@since Method available since Release 3.3.0

Parameters

DOMNode $node:

1 call to PHPUnit_Util_XML::removeCharacterDataNodes()
PHPUnit_Framework_Assert::assertEqualXMLStructure in vendor/phpunit/phpunit/src/Framework/Assert.php
Asserts that a hierarchy of DOMElements matches.

File

vendor/phpunit/phpunit/src/Util/XML.php, line 177

Class

PHPUnit_Util_XML
XML helpers.

Code

public static function removeCharacterDataNodes(DOMNode $node) {
  if ($node
    ->hasChildNodes()) {
    for ($i = $node->childNodes->length - 1; $i >= 0; $i--) {
      if (($child = $node->childNodes
        ->item($i)) instanceof DOMCharacterData) {
        $node
          ->removeChild($child);
      }
    }
  }
}