PluginProbe
Parse.ly / 3.24.2
Parse.ly v3.24.2
3.24.3 3.24.2 3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 All 107 releases
wp-parsely / vendor / masterminds / html5 / src / HTML5 / Parser / README.md

README.md in Parse.ly 3.24.2, at vendor/masterminds/html5/src/HTML5/Parser/README.md

54 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # The Parser Model
2
3 The parser model here follows the model in section
4 [](http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#parsing8.2.1](http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#parsing](http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#parsing)
5 of the HTML5 specification, though we do not assume a networking layer.
6
7 [ InputStream ] // Generic support for reading input.
8 ||
9 [ Scanner ] // Breaks down the stream into characters.
10 ||
11 [ Tokenizer ] // Groups characters into syntactic
12 ||
13 [ Tree Builder ] // Organizes units into a tree of objects
14 ||
15 [ DOM Document ] // The final state of the parsed document.
16
17
18 ## InputStream
19
20 This is an interface with at least two concrete implementations:
21
22 - StringInputStream: Reads an HTML5 string.
23 - FileInputStream: Reads an HTML5 file.
24
25 ## Scanner
26
27 This is a mechanical piece of the parser.
28
29 ## Tokenizer
30
31 This follows section 8.4 of the HTML5 spec. It is (roughly) a recursive
32 descent parser. (Though there are plenty of optimizations that are less
33 than purely functional.
34
35 ## EventHandler and DOMTree
36
37 EventHandler is the interface for tree builders. Since not all
38 implementations will necessarily build trees, we've chosen a more
39 generic name.
40
41 The event handler emits tokens during tokenization.
42
43 The DOMTree is an event handler that builds a DOM tree. The output of
44 the DOMTree builder is a DOMDocument.
45
46 ## DOMDocument
47
48 PHP has a DOMDocument class built-in (technically, it's part of libxml.)
49 We use that, thus rendering the output of this process compatible with
50 SimpleXML, QueryPath, and many other XML/HTML processing tools.
51
52 For cases where the HTML5 is a fragment of a HTML5 document a
53 DOMDocumentFragment is returned instead. This is another built-in class.
54