us.codecraft.xsoup.bridge.SipSoupXPathEvaluator Maven / Gradle / Ivy
package us.codecraft.xsoup.bridge;
import org.jsoup.nodes.Element;
import com.virjar.sipsoup.exception.FinalTypeNotSameException;
import com.virjar.sipsoup.model.SIPNode;
import com.virjar.sipsoup.model.XpathEvaluator;
import us.codecraft.xsoup.XElements;
import us.codecraft.xsoup.XPathEvaluator;
/**
* Created by virjar on 17/6/19.
*/
public class SipSoupXPathEvaluator implements XPathEvaluator {
private XpathEvaluator delegate;
public SipSoupXPathEvaluator(XpathEvaluator delegate) {
this.delegate = delegate;
}
@Override
public XElements evaluate(Element element) {
return new DefaultXElements(delegate.evaluate(element));
}
@Override
public boolean hasAttribute() {
try {
return delegate.judeNodeType() == SIPNode.NodeType.TEXT;
} catch (FinalTypeNotSameException e) {
throw new IllegalStateException("combine xpath expression has different return type", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy