Example usage for org.jdom2.xpath XPathFactory compile

List of usage examples for org.jdom2.xpath XPathFactory compile

Introduction

In this page you can find the example usage for org.jdom2.xpath XPathFactory compile.

Prototype

public <T> XPathExpression<T> compile(String expression, Filter<T> filter, Map<String, Object> variables,
        Collection<Namespace> namespaces) 

Source Link

Document

Create a XPathExpression<> instance from this factory.

Usage

From source file:sample.webservices.endpoint.HolidayEndpoint.java

License:Apache License

public HolidayEndpoint(HumanResourceService humanResourceService)
        throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
    this.humanResourceService = humanResourceService;
    Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
    XPathFactory xPathFactory = XPathFactory.instance();
    this.startDateExpression = xPathFactory.compile("//hr:StartDate", Filters.element(), null, namespace);
    this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null, namespace);
    this.nameExpression = xPathFactory.compile("concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(),
            null, namespace);/*from  w ww .  j a v  a 2  s  .c om*/
}

From source file:sample.ws.endpoint.HolidayEndpoint.java

License:Apache License

@Autowired
public HolidayEndpoint(HumanResourceService humanResourceService)
        throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
    this.humanResourceService = humanResourceService;

    Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);

    XPathFactory xPathFactory = XPathFactory.instance();

    this.startDateExpression = xPathFactory.compile("//hr:StartDate", Filters.element(), null, namespace);
    this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null, namespace);
    this.nameExpression = xPathFactory.compile("concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(),
            null, namespace);//from w  w  w. ja  v  a 2 s . c  o  m
}

From source file:se.miun.itm.input.util.xml.XPathProcessor.java

License:Open Source License

public static List<Element> query(String expression, Namespace nameSpace, Object context)
        throws InPUTException {
    XPathFactory inst;
    inst = XPathFactory.instance();
    expression = correctNamespaceInPUT(expression, nameSpace);

    XPathExpression<Element> expr = inst.compile(expression, ELEMENT_FILTER, null, nameSpace);
    return expr.evaluate(context);
}

From source file:test.sql.XPathModifier.java

License:Apache License

String getElementValueNew(Document doc, String elementToFind) {

    String val = null;

    if ((doc == null) || (elementToFind == null))
        return null;

    if (debugFlag)
        System.out.println("getElementValueNew:  looking for " + elementToFind);

    XPathFactory xpf = XPathFactory.instance();
    if (debugFlag)
        System.out.println("number of namespaces:  " + namespaces.size());

    XPathExpression<Element> xpath = xpf.compile(elementToFind, Filters.element(), null, namespaces);

    Element el = xpath.evaluateFirst(doc);

    return el.getText();
}

From source file:us.xwhite.dvd.endpoint.RentalEndpoint.java

License:Apache License

public RentalEndpoint(RentalService rentalService)
        throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
    this.rentalService = rentalService;
    Namespace namespace = Namespace.getNamespace("sakila", NAMESPACE_URI);
    XPathFactory xPathFactory = XPathFactory.instance();
    this.storeId = xPathFactory.compile("//@storeId", Filters.attribute(), null, namespace);
    this.filmTitles = xPathFactory.compile("//@title", Filters.attribute(), null, namespace);
}