【发布时间】:2019-01-03 23:26:22
【问题描述】:
使用通过 apt 安装的JAR 文件为Saxon-HE 和tagsoup 解析html 是单行的:
thufir@dur:~/saxon$
thufir@dur:~/saxon$ java -cp /usr/share/java/Saxon-HE-9.8.0.14.jar:/usr/share/java/tagsoup-1.2.1.jar net.sf.saxon.Query -x:org.ccil.cowan.tagsoup.Parser -qs:doc\(\'http://books.toscrape.com/\'\)
<?xml version="1.0" encoding="UTF-8"?><!--[if lt IE 7]> <html lang="en-us" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><!--[if IE 7]> <html lang="en-us" class="no-js lt-ie9 lt-ie8"> <![endif]--><!--[if IE 8]> <html lang="en-us" class="no-js lt-ie9"> <![endif]--><!--[if gt IE 8]><!--><html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" class="no-js" lang="en-us"><!--<![endif]--><head><title>
All products | Books to Scrape - Sandbox
..
<!-- Version: N/A -->
thufir@dur:~/saxon$
thufir@dur:~/saxon$
我将如何从 Java 中执行此操作? 特别是,此执行需要从 Saxon 导入哪些内容? Perhaps 使用 Saxon 和 JAXP 接口?
还有:
http://codingwithpassion.blogspot.com/2011/03/saxon-xslt-java-example.html
【问题讨论】:
标签: java xml xquery saxon tag-soup