I have written a program which scans css files using jar cssparser-0.9.5.jar and i performed some operation on it
public static Map<String, CSSStyleRule> parseCSS(String FileName) throws IOException {
Map<String, CSSStyleRule> rules = new LinkedHashMap<String, CSSStyleRule>();
InputSource inputSource = new InputSource(
new FileReader(FileName));
CSSStyleSheet styleSheet = new CSSOMParser().parseStyleSheet(
inputSource, null, null);
CSSRuleList ruleList = styleSheet.getCssRules();
for (int i = 0; i < ruleList.getLength(); i++) {
CSSRule rule = ruleList.item(i);
if (rule.getType() == CSSRule.STYLE_RULE) {
CSSStyleRule styleRule = (CSSStyleRule) rule;
rules.put(styleRule.getSelectorText(), styleRule);
}
}
return rules;
}
this code works fine for all classes except for class which contain properties which start with '-' like
.overlay
{
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');
}
after parsing it give error for double ':' present in class .overlay's properties
so is there any idea to solve this problem?