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

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

There is a newer version: 0.3.7
Show newest version
package us.codecraft.xsoup;

import org.jsoup.nodes.Element;

/**
 * XPath result.
 *
 * @author [email protected]
 */
public class DefaultXElement implements XElement {

    private Element element;

    private ElementOperator elementOperator;

    public DefaultXElement(Element element, ElementOperator elementOperator) {
        this.element = element;
        this.elementOperator = elementOperator;
    }

    @Override
    public String get(){
        return get(elementOperator);
    }

    protected String get(ElementOperator elementOperator){
        if (elementOperator == null) {
            return element.toString();
        } else {
            return elementOperator.operate(element);
        }
    }

    public String toString() {
         return get();
    }

    @Override
    public Element getElement() {
        return element;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy