Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Traverser.php

function 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 88

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;
        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;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal