HtmlTokenizer
        
        extends Base
    
    
            
            in package
            
        
    
            
            implements
                            Iterator                    
    
    
        
            Een tokenizer voor htmlcode.
Met name geschikt voor html met fouten. Met de uitvoer kun je de exacte (foute) html weer reconstrueren.
Vaak is een oplossing mogelijk met DOMDocument of SimpleXML. Gebruik in die gevallen niet deze tokenizer.
Gebruik deze tokenizer als je een tag/attribuut wilt vervangen en de overige (mogelijk foutieve) html intact wilt laten. Daarnaast is het triviaal om een syntax highlighter te maken met deze tokenizer.
Tokens
<T_TAG T_ATTRIBUTE=T_VALUE>T_TEXT</T_CLOSE_TAG> ^ ^ T_WHITESPACE ^ ^ T_OPEN ^ T_CLOSE
T_TAG        Het type element 'div', 'a', 'br', enz. Kan een  of 
 zijn.
T_WHITESPACE Een spatie of newline binnen een tag.
T_ATTRIBUTE  De naam van het attribuut bv 'href'
T_VALUE      De waarde van een attribuut
T_TEXT      De tekst voor of na een T_TAG of T_CLOSE_TAG
T_CLOSE_TAG  Het type sluit tag bevat 'a' van een ''
T_LT         Een '<' die niet voor opmaak gebruikt wordt
T_DELIMITER  De " of ' die om de T_VALUE staan
T_COMMENT    De inhoud van een comment blok
T_SCRIPT     De inhoud van de een <script> blok
T_CDATA T_DTD_ENTITY T_INVALID Een character dat niet klopt. Deze zal de parsen moeten/kunnen negeren.
Tags
Interfaces, Classes, Traits and Enums
- Iterator
 
Table of Contents
- $warnings : array<string|int, mixed>
 - Generated parser warnings. (The tokenizer doesn't report warnings it just stores them in this array).
 - $currentTag : mixed
 - $dtdLevel : int
 - $html : string
 - The html code this tokenizer is parsing.
 - $htmlLength : int
 - Number of characters in the html string.
 - $iteratorCurrent : array<string|int, mixed>|string
 - Iterator::current().
 - $iteratorKey : int
 - Iterator::key().
 - $position : mixed
 - $state : string
 - CONTENT, TAG_BODY, VALUE.
 - $tagType : string
 - T_TAG of T_CLOSE_TAG.
 - $tokenQueue : array<string|int, mixed>
 - $valid : bool
 - Iterator::valid().
 - $wsArray : array<string|int, mixed>
 - Array containing possible whitespace characters.
 - $wsPattern : string
 - String containing whitespace characters (for use in regular expressions).
 - __call() : mixed
 - Report that the $method doesn't exist.
 - __callStatic() : mixed
 - Report that the $method doesn't exist.
 - __construct() : mixed
 - __get() : mixed
 - Report that $property doesn't exist.
 - __set() : mixed
 - Report that $property doesn't exist and set the property to the given $value.
 - __toString() : string
 - The object is used as an string.
 - buildLastToken() : mixed
 - buildToken() : mixed
 - Een token instellen o.b.v. van de eind positie van de token.
 - collectWhitespace() : mixed
 - current() : mixed
 - dump() : mixed
 - Geef een syntax highlighted versie van de html. (Het title attribute wordt ingesteld met het tag type).
 - firstOccurrance() : int
 - getChar() : char
 - Het karakter op huidige positie.
 - key() : mixed
 - next() : mixed
 - parseContent() : mixed
 - Verzameld alle T_TEXT tokens.
 - parseDTDAttributes() : mixed
 - parseDTDElements() : mixed
 - parseDTDTag() : mixed
 - CDATA & Inline DTD tags.
 - parseHtmlComment() : mixed
 - parseParserTag() : mixed
 - <?xml ?> en <?php ?> tags.
 - parseScript() : mixed
 - parseTag() : mixed
 - parseTagBody() : mixed
 - parseToken() : array<string|int, mixed>
 - parseValue() : mixed
 - rewind() : mixed
 - stripos() : mixed
 - Een strpos op de $html relatief vanaf de huidige $position.
 - strpos() : mixed
 - Een strpos op de $html relatief vanaf de huidige $position.
 - substr() : mixed
 - Een substr op de $html relatief vanaf de huidige $position.
 - valid() : mixed
 - warning() : mixed
 
Properties
$warnings
Generated parser warnings. (The tokenizer doesn't report warnings it just stores them in this array).
    public
        array<string|int, mixed>
    $warnings
     = []
    
    
    
$currentTag
    private
        mixed
    $currentTag
    
        
        
    
$dtdLevel
    private
        int
    $dtdLevel
    
    
    
    
$html
The html code this tokenizer is parsing.
    private
        string
    $html
    
    
    
    
$htmlLength
Number of characters in the html string.
    private
        int
    $htmlLength
    
    
    
    
$iteratorCurrent
Iterator::current().
    private
        array<string|int, mixed>|string
    $iteratorCurrent
    
    
    
    
$iteratorKey
Iterator::key().
    private
        int
    $iteratorKey
    
    
    
    
$position
    private
        mixed
    $position
    
        
        
    
$state
CONTENT, TAG_BODY, VALUE.
    private
        string
    $state
    
    
    
    
$tagType
T_TAG of T_CLOSE_TAG.
    private
        string
    $tagType
    
    
    
    
$tokenQueue
    private
        array<string|int, mixed>
    $tokenQueue
     = []
    
    
    
$valid
Iterator::valid().
    private
        bool
    $valid
    
    
    
    
$wsArray
Array containing possible whitespace characters.
    private
        array<string|int, mixed>
    $wsArray
    
    
    
    
$wsPattern
String containing whitespace characters (for use in regular expressions).
    private
        string
    $wsPattern
    
    
    
    
Methods
__call()
Report that the $method doesn't exist.
    public
                __call(string $method, array<string|int, mixed> $arguments) : mixed
    
        Parameters
- $method : string
 - $arguments : array<string|int, mixed>
 
Return values
mixed —__callStatic()
Report that the $method doesn't exist.
    public
            static    __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
    
        Parameters
- $method : string
 - $arguments : array<string|int, mixed>
 
Return values
mixed —__construct()
    public
                __construct(mixed $html) : mixed
        
        Parameters
- $html : mixed
 
Return values
mixed —__get()
Report that $property doesn't exist.
    public
                __get(string $property) : mixed
    
        Parameters
- $property : string
 
Return values
mixed —__set()
Report that $property doesn't exist and set the property to the given $value.
    public
                __set(string $property, mixed $value) : mixed
    
        Parameters
- $property : string
 - $value : mixed
 
Return values
mixed —__toString()
The object is used as an string.
    public
                __toString() : string
    
    
    
        Return values
string —buildLastToken()
    public
                buildLastToken(mixed $type) : mixed
        
        Parameters
- $type : mixed
 
Return values
mixed —buildToken()
Een token instellen o.b.v. van de eind positie van de token.
    public
                buildToken(mixed $endPosition[, mixed $tokenType = null ]) : mixed
        Zal de $this->position bijwerken.
Parameters
- $endPosition : mixed
 - $tokenType : mixed = null
 
Return values
mixed —collectWhitespace()
    public
                collectWhitespace([mixed $tokenType = 'T_WHITESPACE' ]) : mixed
        
        Parameters
- $tokenType : mixed = 'T_WHITESPACE'
 
Return values
mixed —current()
    public
                current() : mixed
        
    
    
        Return values
mixed —dump()
Geef een syntax highlighted versie van de html. (Het title attribute wordt ingesteld met het tag type).
    public
                dump([ $charset = 'UTF-8' ]) : mixed
    
        Parameters
Return values
mixed —firstOccurrance()
    public
                firstOccurrance(mixed $needles[, mixed &$match = null ]) : int
    
        Parameters
- $needles : mixed
 - $match : mixed = null
 
Return values
int —de positie van de needle die het eerste voorkomt in de string
getChar()
Het karakter op huidige positie.
    public
                getChar() : char
    
    
    
        Return values
char —key()
    public
                key() : mixed
        
    
    
        Return values
mixed —next()
    public
                next() : mixed
        
    
    
        Return values
mixed —parseContent()
Verzameld alle T_TEXT tokens.
    public
                parseContent() : mixed
    
    
    
        Return values
mixed —parseDTDAttributes()
    public
                parseDTDAttributes(mixed $state) : mixed
        
        Parameters
- $state : mixed
 
Return values
mixed —parseDTDElements()
    public
                parseDTDElements() : mixed
        
    
    
        Return values
mixed —parseDTDTag()
CDATA & Inline DTD tags.
    public
                parseDTDTag() : mixed
    
    
    
    Tags
Return values
mixed —parseHtmlComment()
    public
                parseHtmlComment() : mixed
        
    
    
        Return values
mixed —parseParserTag()
<?xml ?> en <?php ?> tags.
    public
                parseParserTag() : mixed
    
    
    
        Return values
mixed —parseScript()
    public
                parseScript() : mixed
        
    
    
        Return values
mixed —parseTag()
    public
                parseTag() : mixed
        
    
    
        Return values
mixed —parseTagBody()
    public
                parseTagBody() : mixed
    
    
    
        Return values
mixed —parseToken()
    public
                parseToken() : array<string|int, mixed>
    
    
    
        Return values
array<string|int, mixed> —Token
parseValue()
    public
                parseValue() : mixed
        
    
    
        Return values
mixed —rewind()
    public
                rewind() : mixed
        
    
    
        Return values
mixed —stripos()
Een strpos op de $html relatief vanaf de huidige $position.
    public
                stripos(mixed $needle) : mixed
    
        Parameters
- $needle : mixed
 
Return values
mixed —strpos()
Een strpos op de $html relatief vanaf de huidige $position.
    public
                strpos(mixed $needle) : mixed
    
        Parameters
- $needle : mixed
 
Return values
mixed —substr()
Een substr op de $html relatief vanaf de huidige $position.
    public
                substr(mixed $start[, mixed $length = null ]) : mixed
    
        Parameters
- $start : mixed
 - $length : mixed = null
 
Return values
mixed —valid()
    public
                valid() : mixed
        
    
    
        Return values
mixed —warning()
    public
                warning(mixed $message) : mixed
        
        Parameters
- $message : mixed