Getting style information (css) of a node after parsing an html page in Java

北战南征 提交于 2019-12-24 06:37:28

问题


I'm developing a project who analyzes web pages. I use an Java library for HTML parsing, and it returns an org.w3c.dom document.

Given a tag node in my dom document, I'd like to know all the CSS info connected to that node (including override/inheritance).

How I can do this? Searching on Google, I found some CSS parsers that generate an org.w3c.dom document, but how should I mix them?


回答1:


jStyleParser provides exactly this functionality. It parses all the referenced style sheets and maps them to the DOM tree nodes. More options are offered for a similar question here.



来源:https://stackoverflow.com/questions/11473410/getting-style-information-css-of-a-node-after-parsing-an-html-page-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!