You are here

public function Traverser::node in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php \Masterminds\HTML5\Serializer\Traverser::node()

Process a node in the DOM.

Parameters

mixed $node: A node implementing \DOMNode.

2 calls to Traverser::node()
Traverser::children in vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php
Walk through all the nodes on a node list.
Traverser::walk in vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php
Tell the traverser to walk the DOM.

File

vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php, line 93

Class

Traverser
Traverser for walking a DOM tree.

Namespace

Masterminds\HTML5\Serializer

Code

public function node($node) {

  // A listing of types is at http://php.net/manual/en/dom.constants.php
  switch ($node->nodeType) {
    case XML_ELEMENT_NODE:
      $this->rules
        ->element($node);
      break;
    case XML_TEXT_NODE:
      $this->rules
        ->text($node);
      break;
    case XML_CDATA_SECTION_NODE:
      $this->rules
        ->cdata($node);
      break;

    // FIXME: It appears that the parser doesn't do PI's.
    case XML_PI_NODE:
      $this->rules
        ->processorInstruction($node);
      break;
    case XML_COMMENT_NODE:
      $this->rules
        ->comment($node);
      break;

    // Currently we don't support embedding DTDs.
    default:

      //print '<!-- Skipped -->';
      break;
  }
}