使用JAR
通过 apt for 安装的文件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
此执行需要哪些导入? 也许使用Saxon
和 JAXP 接口?
还:
http://codingwithpassion.blogspot.com/2011/03/saxon-xslt-java-example.html