软件介绍
jStyleParser 是一个开源 Java 的 CSS 解析器,可以在 Java 程序中解析 CSS 样式文件。
Maven
net.sf.cssbox
jstyleparser
3.2
示例代码://get the element style
StyleMap map = CSSFactory.assignDOM(doc, encoding, base, medium, true);
NodeData style = map.get(element);
//get the type of the assigned value
CSSProperty.Margin mm = style.getProperty("margin-top");
System.out.println("margin-top=" + mm);
//if a length is specified, obtain the exact value
if (mm == Margin.length)
{
TermLength mtop = style.getValue(TermLength.class, "margin-top");
System.out.println("value=" + mtop);
}
为你推荐: