This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
通过像 jOOX 这样的实用程序,您可以包装 DOM 文档并使用类似 jQuery 的 API 来实现你所需要的。您有多种选择:
使用 XPath(当然,您可以直接使用标准 Java XPath API,而不是使用 jOOX)
使用 CSS 样式选择器
使用 jOOX API
返回的 org.joox.Match 对象可以以多种方式使用,例如用于迭代:
With a utility like jOOX, you can wrap your DOM document and use a jQuery-like API to achieve what you need. You have several options:
Using XPath (of course, instead of using jOOX, you could use the standard Java XPath API directly)
Using CSS-style selectors
Using the jOOX API
The returned
org.joox.Match
object can then be used in various ways, e.g. for iteration:我不知道 Java 中的 XML/DOM 解析有哪些选项,也不知道您当前正在使用什么(如果有的话),但是,如果您有某种方法通过 CSS 选择器查找元素( js 框架中的常见功能),那么 CSS 属性选择器 将是去的方式 去。
Google 开启了 CSS 选择器的 Java 实现,也许会有所帮助。
I have no idea what the options are as far as the XML/DOM parsing in Java, and I don't know what (if anything) you're using currently, but, if you have some way of finding elements via CSS selectors (a common feature in js frameworks), then CSS attribute selectors would be the way to go.
Google turned this Java implementation of CSS selectors up, perhaps it'll help.