Use CSS selectors to collect HTML elements from a streaming parser (e.g. SAX stream)

Posted by Jakub Narebski on Stack Overflow See other posts from Stack Overflow or by Jakub Narebski
Published on 2011-01-11T11:11:43Z Indexed on 2011/01/11 12:53 UTC
Read the original article Hit count: 177

Filed under:
|
|

How to parse CSS (CSS3) selector and use it (in jQuery-like way) to collect HTML elements not from DOM (from tree structure), but from stream (e.g. SAX), i.e. using sequential access parser? Are there CSS selectors that need access to DOM (Wikipedia SAX page says that XPath selectors "need to be able to access any node at any time in the parsed XML tree")?

I am most inetersted in implementing selector combinators, e.g. 'A B' descendant selector.

I prefer solutions describing algorithm, or in Perl.

© Stack Overflow or respective owner

Related posts about html

Related posts about css-selectors