|There's more than one way to do things|
"combined" HTML *and* CSS parser?by telcontar (Beadle)
|on Apr 12, 2005 at 19:05 UTC||Need Help??|
telcontar has asked for the
wisdom of the Perl Monks concerning the following question:
let me see if I can explain this in a satisfactory way.
I have been using HTML::Tree to parse HTML documents, and I could use some CSS parser to parse CSS files (or statements). But how do I put them in context- use them together? This will give me two parse trees, but what I'd rather have is a single tree where I can access CSS properties at the level of HTML elements.
For instance, if I have a simple CSS rule, and I get a parse tree out of it, how am I to know which HTML elements it will apply to? This depends on the property (since some properties have no rendering effect on some types of elements), on inheritance, etc.
In short, is there any way to combine some HTML and CSS browsers so that, in the HTML parse tree, one can tell which elements effectively have which CSS properties? (Except for taking apart some browser source code)
Does this make any sense at all?