Package org.jdom.xpath

Examples of org.jdom.xpath.XPath.selectNodes()


      // Retrieve normalization information
      retrieveNormalization(root, normalization);

      // Retrieve back links
      XPath xpaPages = XPath.newInstance("/api/query/pages/page");
      List listPages = xpaPages.selectNodes(root);
      Iterator itPage = listPages.iterator();
      XPath xpaLinks = XPath.newInstance("links/pl");
      while (itPage.hasNext()) {
        Element pageNode = (Element) itPage.next();
        String pageTitle = pageNode.getAttributeValue("title");
View Full Code Here


        List<Page> links = lists.get(pageTitle);
        if (links == null) {
          links = new ArrayList<Page>();
          lists.put(pageTitle, links);
        }
        List listLinks = xpaLinks.selectNodes(pageNode);
        Iterator itLinks = listLinks.iterator();
        while (itLinks.hasNext()) {
          Element linkNode = (Element) itLinks.next();
          Page link = DataManager.getPage(
              getWiki(), linkNode.getAttributeValue("title"), null, null, null);
View Full Code Here

      // Retrieve normalization information
      retrieveNormalization(root, normalization);

      // Retrieve back links
      XPath xpaPages = XPath.newInstance("/api/query/pages/page");
      List listLinks = xpaPages.selectNodes(root);
      Iterator itLinks = listLinks.iterator();
      while (itLinks.hasNext()) {
        Element linkNode = (Element) itLinks.next();
        Page link = getPage(getWiki(), linkNode, knownPages, useDisambig);
        if ((redirects != null) && (link.isRedirect())) {
View Full Code Here

    try {
      Element root = getRoot(properties, ApiRequest.MAX_ATTEMPTS);

      // Retrieve query pages
      XPath xpa = XPath.newInstance("/api/query/querypage/results/page");
      List results = xpa.selectNodes(root);
      Iterator iter = results.iterator();
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        Page page = DataManager.getPage(
            getWiki(), currentNode.getAttributeValue("title"), null, null, null);
View Full Code Here

    try {
      Element root = getRoot(properties, ApiRequest.MAX_ATTEMPTS);

      // Get recent changes list
      XPath xpa = XPath.newInstance("/api/query/users/user");
      List results = xpa.selectNodes(root);
      Iterator iter = results.iterator();
      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        User user = new User(currentNode.getAttributeValue("name"));
        List<String> groups = new ArrayList<String>();
View Full Code Here

      while (iter.hasNext()) {
        Element currentNode = (Element) iter.next();
        User user = new User(currentNode.getAttributeValue("name"));
        List<String> groups = new ArrayList<String>();
        XPath xpaGroups = XPath.newInstance("./groups/g");
        List resultGroups = xpaGroups.selectNodes(currentNode);
        Iterator itGroups = resultGroups.iterator();
        while (itGroups.hasNext()) {
          groups.add(((Element) itGroups.next()).getValue());
        }
        user.setGroups(groups);
View Full Code Here

          groups.add(((Element) itGroups.next()).getValue());
        }
        user.setGroups(groups);
        List<String> rights = new ArrayList<String>();
        XPath xpaRights = XPath.newInstance("./rights/r");
        List resultRights = xpaRights.selectNodes(currentNode);
        Iterator itRights = resultRights.iterator();
        while (itRights.hasNext()) {
          rights.add(((Element) itRights.next()).getValue());
        }
        user.setRights(rights);
View Full Code Here

    }
   
    // Check for errors
    try {
      XPath xpa = XPath.newInstance("/api/error");
      List listErrors = xpa.selectNodes(root);
      if (listErrors != null) {
        Iterator iterErrors = listErrors.iterator();
        XPath xpaCode = XPath.newInstance("./@code");
        XPath xpaInfo = XPath.newInstance("./@info");
        while (iterErrors.hasNext()) {
View Full Code Here

    }
   
    // Check for warnings
    try {
      XPath xpa = XPath.newInstance("/api/warnings/*");
      List listWarnings = xpa.selectNodes(root);
      if (listWarnings != null) {
        Iterator iterWarnings = listWarnings.iterator();
        while (iterWarnings.hasNext()) {
          Element currentNode = (Element) iterWarnings.next();
          log.warn("Warning reported: " + currentNode.getName() + " - " + currentNode.getValue());
View Full Code Here

      return false;
    }
    boolean result = false;
    try {
      XPath xpa = XPath.newInstance(queryContinue);
      List results = xpa.selectNodes(root);
      if (results != null) {
        for (Object currentNode : results) {
          List attributes = ((Element) currentNode).getAttributes();
          if (attributes != null) {
            for (Object currentAttribute : attributes) {
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.