On Wed, 2012-10-31 at 22:30 +0100, Rüdiger Rill wrote:
> What I would like to do, is go through a list of styles and store the
> information in my own data structure (NSDictionary) for easy lookup
> (since I'm using cocoa anyway).
> I searched the headers and the net but found no way to go through a
> list (linked list, whatever) to get the properties off all styles, one
> after one, without knowing their names.
> Is there such a way? Or do I have to parse the html, get the names and
> then look everything up via css_select?
There is no way to get a list of styles out of libcss; it is very much
designed as a black box which you ask questions of. Internally, libcss
does not store style information in a way that is generally useful to
third parties.
If you're going to store the style information in your own data
structure, you'll be needing to implement the CSS cascade yourself. To
find the styles that apply to an element in the HTML document, you'll
need to parse the HTML document first.
Thus, unless you have burning desire to implement the CSS style
selection algorithm yourself, I'd strongly suggest using libcss the way
it was intended and ask it to select styles for you using
css_select_style().
J.
No comments:
Post a Comment