【发布时间】:2015-01-07 18:30:03
【问题描述】:
如线程 How to parse HTML using XPath with Saxon-HE in command line? 中所见,我尝试使用 Saxon 和 XPath 查询 HTML。
到目前为止,我在 Linux shell 中的尝试:
java -classpath "./tagsoup-1.2.jar:./saxon9he.jar" \
net.sf.saxon.Query \
-x:org.ccil.cowan.tagsoup.Parser \
-s:https://stackoverflow.com/questions/27826172 \
-qs:'/*:html/*:head/*:title/text()'
它可以工作,但我想设置一个 默认命名空间 以便能够查询没有前缀或通配符的 HTML 文件,例如:
/html/head/title/text()
应该是一个有效的查询。
有什么想法吗?
【问题讨论】: