Package org.jdom2.xpath

Examples of org.jdom2.xpath.XPathFactory.compile()


                  URL resource = resources.nextElement();
                 
                  log.debug( "reading " + resource.toString() );
                  Document doc = builder.build( resource );
                  XPathFactory xpfac = XPathFactory.instance();
                  XPathExpression< Element > xp = xpfac.compile( requestedNodes, Filters.element() );
                  readed.addAll( xp.evaluate( doc ) ); // filter out repeated items
              }
        return new ArrayList< Element >( readed );
      } catch ( IOException ioe ) {
        log.error( "Couldn't load all " + xml + " resources", ioe );
View Full Code Here


    if( xmlStream != null && StringUtils.isNotEmpty( requestedNodes ) ) {
      SAXBuilder builder = new SAXBuilder();
      try {
                Document doc = builder.build( xmlStream );
                XPathFactory xpfac = XPathFactory.instance();
                XPathExpression< Element > xp = xpfac.compile( requestedNodes, Filters.element() );
               
        return xp.evaluate( doc );
      } catch ( IOException ioe ) {
        log.error( "Couldn't load all " + xmlStream + " resources", ioe );
      } catch ( JDOMException jdome ) {
View Full Code Here

    final Document document = (Document) models.get("jdom2");
   
    final XPathFactory xpathFactory = XPathFactory.instance();
    final Filter<LocatedElement> filter = Filters.fclass(LocatedElement.class);
    Namespace mavenNamespace = Namespace.getNamespace("m", "http://maven.apache.org/POM/4.0.0");
    final XPathExpression<LocatedElement> dependenciesXpath = xpathFactory.compile("/m:project/m:dependencies/m:dependency", filter, null, mavenNamespace);
    final XPathExpression<LocatedElement> managedDependenciesXpath = xpathFactory.compile("/m:project/m:dependencyManagement/m:dependency", filter, null, mavenNamespace);
   
    final List<LocatedElement> dependencies = dependenciesXpath.evaluate(document);
    final List<LocatedElement> managedDependencies = managedDependenciesXpath.evaluate(document);
   
View Full Code Here

   
    final XPathFactory xpathFactory = XPathFactory.instance();
    final Filter<LocatedElement> filter = Filters.fclass(LocatedElement.class);
    Namespace mavenNamespace = Namespace.getNamespace("m", "http://maven.apache.org/POM/4.0.0");
    final XPathExpression<LocatedElement> dependenciesXpath = xpathFactory.compile("/m:project/m:dependencies/m:dependency", filter, null, mavenNamespace);
    final XPathExpression<LocatedElement> managedDependenciesXpath = xpathFactory.compile("/m:project/m:dependencyManagement/m:dependency", filter, null, mavenNamespace);
   
    final List<LocatedElement> dependencies = dependenciesXpath.evaluate(document);
    final List<LocatedElement> managedDependencies = managedDependenciesXpath.evaluate(document);
   
   
View Full Code Here

        while( resources.hasMoreElements() ) {
                  URL resource = resources.nextElement();
                  log.debug( "reading " + resource.toString() );
                  Document doc = builder.build( resource );
                  XPathFactory xpfac = XPathFactory.instance();
                  XPathExpression<Element> xp = xpfac.compile( requestedNodes, Filters.element() );
                  readed.addAll( xp.evaluate( doc ) ); // filter out repeated items
              }
        return new ArrayList<Element>( readed );
      } catch ( IOException ioe ) {
        log.error( "Couldn't load all " + xml + " resources", ioe );
View Full Code Here

    if( xmlStream != null && StringUtils.isNotEmpty( requestedNodes ) ) {
      SAXBuilder builder = new SAXBuilder();
      try {
                Document doc = builder.build(xmlStream);
                XPathFactory xpfac = XPathFactory.instance();
                XPathExpression< Element > xp = xpfac.compile(requestedNodes,Filters.element());
        return xp.evaluate( doc );
      } catch ( IOException ioe ) {
        log.error( "Couldn't load all " + xmlStream + " resources", ioe );
      } catch ( JDOMException jdome ) {
        log.error( "error parsing " + xmlStream + " resources", jdome );
View Full Code Here

    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,
View Full Code Here

    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);
  }
View Full Code Here

    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);
  }

  @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.