views:

406

answers:

3

I'm building something that requires a simple HTML frontend for editing some properties in CSS. However, I need to get the value specified by a CSS file.

The only parser I can find is CSS Parser Project , and it is in Java. It implements both Document Object Model Level 2 Style & SAC: The Simple API for CSS API. It should work, but we have not tried. Any tutorial on this project or the API's?

Another solution my team can think of is to push that responsibility to the client's browser + jQuery. However, it doesn't seem very reliable and efficient.

Regular expression does not seem to be the right tool for fishing out properties from CSS.

Anyone has a better/simpler solution? Thanks!

+1  A: 

Ben Nadel has created a CSS parser in ColdFusion - it's not fully featured yet, but it might be good enough?

He's also been doing a lot of other CSS-related stuff recently, so if you need more things take a poke around his blog.

Peter Boughton
wow, great, I'll check it out.
Henry
oh.. I think it doesn't really read and parse a .css file, but thanks anyway! :)
Henry
Oh... yeah, it only does it backwards. Sorry. :(
Peter Boughton
A: 

The only parser I can find is CSS Parser Project ... Any tutorial on this project or the API's?

It looks like this may have beenrenamed from a previous project - here's the API: http://www.docjar.com/docs/api/com/steadystate/css/overview-summary.html

Peter Boughton
Thanks, but that seems old and outdated. Maybe I should get the JAR with source, and generate the javadoc myself?
Henry
+2  A: 

http://sourceforge.net/projects/cssparser/

Henry