I'm looking for some static library or open source project (in obj-c, released under some permissive license) to parse CSS in iPhone. Any recommendations?
-
2can't you abuse `UIWebView` and javascript? – mvds Jul 29 '10 at 12:40
3 Answers
OK, I found good library for parsing CSS - libCSS from the NetSurf web browser project. Released under MIT license, can be used without problems for commercial iPhone applications distributed via the AppStore.
It requires some code for the programmer to write (e.g. you need to provide your own DOM hierarchy handlers), and there are no examples available... but people from the NetSurf dev mailing lists are very helpful. In case of problems you can search the list for my questions.

- 3,637
- 3
- 30
- 43
I would recommend htmlcxx. It's pretty actively maintained, written in C++ and you can use it to parse HTML and CSS.
Of course, since it's written in C++, you can use it in your iPhone application with no problems at all.

- 176,835
- 32
- 241
- 292
-
1
-
indeed, it seems that LGPL is not appstore-friendly: http://stackoverflow.com/questions/459833/which-open-source-licenses-are-compatible-with-the-iphone-and-app-store – Łukasz Sromek Jul 29 '10 at 13:31
-
Actually, LGPL 2.1 is appstore friendly because it has the statically linking clause. However htmlcxx contains code from tree.hh which is GPLed, but that's only used for the HTML part. Perhaps you can ask the author nicely he would consider relicensing the CSS part under 2.1 which is independent of the GPLed code. – mikelikespie Feb 18 '11 at 23:30
-
1Actually, this is not correct. You can use tree.hh as the author specifically provides a separate license when its used with htmlcxx. See http://tree.phi-sci.com/tree.hh. – David H Aug 23 '11 at 16:10
I've taken this project and made it easy to add to your iOS or OSX projects. Clone my github project and add the html (and or css) folder to your project. There is an Xcode project too - so you can build and run the simple test provided by the original authors

- 40,852
- 12
- 92
- 138