Watch 1 Star 2 Fork 0

virjar / xsoup-to-sipsoupJavaApache-2.0

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
将xsoup桥接到jsoup spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

xsoup-to-sipsoup

这是一个桥接器,将sipSoup嫁接到Xsoup上,进而能够在WebMagic上面使用Xpath2.0的语法.配置方案如下

    <dependencies>
        <dependency>
            <groupId>us.codecraft</groupId>
            <artifactId>webmagic-core</artifactId>
            <version>0.6.1</version>
            <exclusions>
                <!-- 排除xsoup的依赖 -->
                <exclusion>
                    <groupId>us.codecraft</groupId>
                    <artifactId>xsoup</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 加入SipSoup的桥接器依赖 -->
        <dependency>
            <groupId>com.virjar</groupId>
            <artifactId>xsoup-to-sipsoup</artifactId>
            <version>RELEASE</version>
        </dependency>
    </dependencies>

maven依赖中这样配置,然后即可正常的在webMagic中使用xpath,当前内部将会将规则嫁接到SipSoup,所以可以使用一切SipSoup支持的高级特性。

特别声明

  1. 由于是桥接,XSoup内部的Xpath相关逻辑是到SipSoup转接,所以如果你的项目有深入到XSoup内部Xpath相关的逻辑,那么这个桥接器将不能适合你
  2. XSoup实现了JSoup到W3C的对象适配,这个功能桥接器并没有实现,如果你使用了相关功能,将会抛出UnsupportedOperationException

祝你好运

Comments ( 0 )

You need to Sign in for post a comment

Help Search