src/PowerTools/HTML5/Parser/Tokenizer.php
protected function processingInstruction() {
        if ($this->scanner->current() != '?') {
            return false;
        }

        $tok = $this->scanner->next();
        $procName = $this->scanner->getAsciiAlpha();
        $white = strlen($this->scanner->whitespace());

        // If not a PI, send to bogusComment.
        if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) {
            $this->parseError("Expected processing instruction name, got $tok");
            $this->bogusComment('<?' . $tok . $procName);
            return true;
        }

        $data = '';
        // As long as it's not the case that the next two chars are ? and >.
        while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
            $data .= $this->scanner->current();

            $tok = $this->scanner->next();
            if ($tok === false) {
                $this->parseError("Unexpected EOF in processing instruction.");
                $this->events->processingInstruction($procName, $data);
                return true;
            }
        }

        $this->scanner->next(); // >
        $this->scanner->next(); // Next token.
        $this->events->processingInstruction($procName, $data);
        return true;
    }
protected function processingInstruction() {
        if ($this->scanner->current() != '?') {
            return false;
        }

        $tok = $this->scanner->next();
        $procName = $this->scanner->getAsciiAlpha();
        $white = strlen($this->scanner->whitespace());

        // If not a PI, send to bogusComment.
        if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) {
            $this->parseError("Expected processing instruction name, got $tok");
            $this->bogusComment('<?' . $tok . $procName);
            return true;
        }

        $data = '';
        // As long as it's not the case that the next two chars are ? and >.
        while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
            $data .= $this->scanner->current();

            $tok = $this->scanner->next();
            if ($tok === false) {
                $this->parseError("Unexpected EOF in processing instruction.");
                $this->events->processingInstruction($procName, $data);
                return true;
            }
        }

        $this->scanner->next(); // >
        $this->scanner->next(); // Next token.
        $this->events->processingInstruction($procName, $data);
        return true;
    }
protected function processingInstruction ( ) { if ( $ this -> scanner -> current ( ) != '?' ) { return false ; } $ tok = $ this -> scanner -> next ( ) ; $ procName = $ this -> scanner -> getAsciiAlpha ( ) ; $ white = strlen ( $ this -> scanner -> whitespace ( ) ) ; // If not a PI, send to bogusComment. if ( strlen ( $ procName ) == 0 || $ white == 0 || $ this -> scanner -> current ( ) == false ) { $ this -> parseError ( "Expected processing instruction name, got $tok" ) ; $ this -> bogusComment ( '<?' . $ tok . $ procName ) ; return true ; } $ data = '' ; // As long as it's not the case that the next two chars are ? and >. while ( ! ( $ this -> scanner -> current ( ) == '?' && $ this -> scanner -> peek ( ) == '>' ) ) { $ data .= $ this -> scanner -> current ( ) ; $ tok = $ this -> scanner -> next ( ) ; if ( $ tok === false ) { $ this -> parseError ( "Unexpected EOF in processing instruction." ) ; $ this -> events -> processingInstruction ( $ procName , $ data ) ; return true ; } } $ this -> scanner -> next ( ) ; // > $ this -> scanner -> next ( ) ; // Next token. $ this -> events -> processingInstruction ( $ procName , $ data ) ; return true ; }
Handle a processing instruction.

XML processing instructions are supposed to be ignored in HTML5,
treated as "bogus comments". However, since we're not a user
agent, we allow them. We consume until ?> and then issue a
EventListener::processingInstruction() event.
Handle a processing instruction .