All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.codecraft.xsoup.Xsoup Maven / Gradle / Ivy

package us.codecraft.xsoup;

/**
 * Created by virjar on 17/6/19.
 */

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import com.virjar.sipsoup.parse.XpathParser;

import us.codecraft.xsoup.bridge.SipSoupXPathEvaluator;

/**
 * @author virjar
 */
public class Xsoup {

    /*-------------     XEvaluator         --------------- */

    public static XElements select(Element element, String xpathStr) {
        return compile(xpathStr).evaluate(element);
    }

    public static XElements select(String html, String xpathStr) {
        return compile(xpathStr).evaluate(Jsoup.parse(html));
    }

    public static XPathEvaluator compile(String xpathStr) {
        return new SipSoupXPathEvaluator(XpathParser.compileNoError(xpathStr));
    }

    /*-------------     W3cAdaptor         --------------- */

    public static org.w3c.dom.Element convertElement(Element element) {
        throw new UnsupportedOperationException("SipSoup bridge can not support adapter JSoup element to w3c Element");
    }

    public static org.w3c.dom.Document convertDocument(Document document) {
        throw new UnsupportedOperationException("SipSoup bridge can not support adapter JSoup element to w3c Element");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy