Forgivingly lexes HTML (SGML-style) markup into tokens.
A lexer parses a string of SGML-style markup and converts them into corresponding tokens. It doesn't check for well-formedness, although its internal mechanism may make this automatic (such as the case of HTMLPurifier_Lexer_DOMLex). There are several implementations to choose from.
A lexer is HTML-oriented: it might work with XML, but it's not recommended, as we adhere to a subset of the specification for optimization reasons. This might change in the future. Also, most tokenizers are not expected to handle DTDs or PIs.
This class should not be directly instantiated, but you may use create() to retrieve a default copy of the lexer. Being a supertype, this class does not actually define any implementation, but offers commonly used convenience functions for subclasses.
Located in /lib/core/Parsers/htmlpurifier/HTMLPurifier.standalone.php (line 5897)
| Class | Description |
|---|---|
| HTMLPurifier_Lexer_PEARSax3 | Proof-of-concept lexer that uses the PEAR package XML_HTMLSax3 to parse HTML. |
| HTMLPurifier_Lexer_DOMLex | Parser that uses PHP 5's DOM extension (part of the core). |
| HTMLPurifier_Lexer_DirectLex | Our in-house implementation of a parser. |
Whether or not this lexer implements line-number/column-number tracking.
If it does, set to true.
Most common entity to raw value conversion table for special entities.
Callback function for escapeCDATA() that does the work.
Retrieves or sets the default Lexer as a Prototype Factory.
By default HTMLPurifier_Lexer_DOMLex will be returned. There are a few exceptions involving special features that only DirectLex implements.
Translates CDATA sections into regular sections (through escaping).
Special CDATA case that is especially convoluted for <script>
Special Internet Explorer conditional comments should be removed.
Takes a string of HTML (fragment or document) and returns the content
Takes a piece of HTML and normalizes it by converting entities, fixing encoding, extracting bits, and other good stuff.
Parses special entities into the proper characters.
This string will translate escaped versions of the special characters into the correct ones.
Lexes an HTML string into tokens.
Documentation generated on Sun, 06 Mar 2011 00:24:10 -0500 by phpDocumentor 1.4.3