Home >Web Front-end >HTML Tutorial >Detailed explanation of a perfect HTML parsing engine (Jumony)
Perhaps many people will think that the current HTML parser is enough, and even simple regular expressions can already meet the needs of manipulating HTML documents. Yes, for the vast majority of HTML documents on the Internet, in fact, most of them meet the XHTML specifications, and their parsing does not require a powerful parser. But a powerful parser is one thing, and a perfect parser is another.
Jumony Core first provides a nearly perfect HTML parsing engine, and its parsing results are infinitely close to those of the browser. Whether it is elements without end tags, elements with optional end tags, tag attributes, or CSS selectors and styles, all legal and illegal HTML documents will be parsed by the browser, and Jumony will parse them into whatever they are. Sample. In other words, the results of Jumony parsing are the same as the results of browser parsing, so you no longer have to worry about whether the HTML document can be recognized. If the browser can read it, Jumony can understand it.
There is only one step between perfection and power, but a perfect parser allows you to never have to care about the HTML source document.
The following is an incomplete list of features supported by the Jumony parser
特性 | 例子 |
孤立的7f19db43d97d2d4008bb10f655c09c49解析为文本 | 3499910bf9dac5ae3c52d5ede7383485>5db79b134e9f6b82c0b36e0489ee08ed应当解析为3499910bf9dac5ae3c52d5ede7383485>5db79b134e9f6b82c0b36e0489ee08ed |
标记属性(没有值的属性) | f396c7ee6581b8a2c1feb962c201109c |
元素丢失结束标签 | e388a4556c0f65e1904146cc1a846bee43091600189d2e5d073500b021ca54e8测试链接94b3e26ee717c64999d7867364b1b4a3 |
可选结束标签元素 "body", "colgroup", "dd", "dt", "head", "html", "li", "option", "p", "tbody", "td", "tfoot", "th", "thead", "tr" |
e388a4556c0f65e1904146cc1a846beeabce388a4556c0f65e1904146cc1a846bee123 |
无结束标签元素 "area", "base", "basefont", "br", "col", "frame", "hr", "img", "input", "isindex", "link", "meta" , "param", "wbr", "bgsound", "spacer", "keygen" |
4faf7b57895b870867b99beee44351ac |
CDataElement | ##3f1c4e4b6b16bbbd69b2ee476dc4f83aif ( 11027f152cc5b3cb62c2e445c3c9a350d" );2cacc6d41bbb37262a98f745aa00fbf0 |
"script", "style", "textarea", "title" | |
Preformatted elements | e03b848252eb9375d56be284e690e873 There is a space in frontbc5574f69a0cba105bc93bd3dc13c4ec |
Use single quotes for attribute values | ##0dbfd9bc5d3c7c92cbdc7be3251a6bb2|
a506a44ecd5500230253bcf07517151a | |
2de933bd81cf0e954926b4b4a48640c3 | |
05797ff6bfecf7b84525904378753179 | |
HTMLDeclaration | 8b05045a5be5764f313ed5b9168a17e6
Selector | Description |
* | Select all elements |
p a | Select descendant elements |
##p>a | Select child elements |
p+a | Select adjacent elements |
Select subsequent elements | |
Attribute existence selection | |
Exact match of attribute value | |
Attribute value approximate match | |
The attribute value starts with matching | |
The attribute value contains Match | |
Attribute value ends with match | |
Attribute value negative matching | |
Negative pseudo-class | |
Unique sub-element pseudo-class | |
only-of-type pseudo-class | |
Empty element pseudo-class | |
Structured pseudo-class | |
Structured pseudo-class | ##:nth-of-type |
structured pseudo-class | |
:nth-last-of-type | Structured pseudo-class |
:first-child | Structured pseudo-class |
:last-child | Structured pseudo-class |
:first-of-type | Structured pseudo-class |
:last-of-type | ##Structured pseudo-class |
The above is the detailed content of Detailed explanation of a perfect HTML parsing engine (Jumony). For more information, please follow other related articles on the PHP Chinese website!