My program need to parse css files into an in-memory object format. Any advice on how this should be done ?
Overview. The CSS Parser is implemented as a package of Java classes, that inputs Cascading Style Sheets source text and outputs a Document Object Model Level 2 Style tree. Alternatively, applications can use SAC: The Simple API for CSS.
Similar to HTML parsing, CSS parsing also starts by tokenizing the CSS source code into tokens, which are then parsed into CSS rules. The parsing rules are described in the CSS syntax spec. However, since the syntax is fairly simple, you are free implement your version of the parsing algorithm to maximize the speed.
ExCSS (supports CSS2.1 and CSS3) on GitHub: https://github.com/TylerBrinks/ExCSS.
Which is a newer version of the code project article: http://www.codeproject.com/KB/recipes/CSSParser.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With