use of org.freud.analysed.css.rule.CssRule in project freud by LMAX-Exchange.
the class CssJdomParser method parseCssRules.
@SuppressWarnings("unchecked")
static Iterable<CssRule> parseCssRules(final Reader reader) throws RecognitionException, IOException {
List<CssRule> cssRuleList = new ArrayList<CssRule>();
Document root = parseCssToDocument(reader);
JXPathContext context = JXPathContext.newContext(root.getRootElement());
List<Element> cssRuleElementList = (List<Element>) context.selectNodes("/RULE");
for (Element element : cssRuleElementList) {
final CssRuleJdom cssRuleJdom = new CssRuleJdom(element, 0);
cssRuleList.add(cssRuleJdom);
for (int i = 1; i < cssRuleJdom.getNumberOfCommaSeparatedSelectorLists(); i++) {
cssRuleList.add(new CssRuleJdom(element, i));
}
}
return cssRuleList;
}