Package org.jdom.xpath

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


        // Get all constraints that match our Role pattern
        selector = "//j:web-app/j:security-constraint[j:auth-constraint/j:role-name=\"" + role.getName() + "\"]";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> roles = xpath.selectNodes( root );

        // If we can't find either one, we must not be constrained
        if ( constraints.size() == 0 )
        {
            return false;
View Full Code Here


        // Get roles referred to by constraints
        String selector = "//j:web-app/j:security-constraint/j:auth-constraint/j:role-name";
        XPath xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> nodes = xpath.selectNodes( root );
        for( Iterator<?> it = nodes.iterator(); it.hasNext(); )
        {
            String role = ( (Element) it.next() ).getTextTrim();
            roles.add( new Role( role ) );
        }
View Full Code Here

        // Get all defined roles
        selector = "//j:web-app/j:security-role/j:role-name";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        nodes = xpath.selectNodes( root );
        for( Iterator<?> it = nodes.iterator(); it.hasNext(); )
        {
            String role = ( (Element) it.next() ).getTextTrim();
            roles.add( new Role( role ) );
        }
View Full Code Here

            Map map = new HashMap();

            XPath passwordPath = XPath.newInstance("/html/body/ul/li/span");
            XPath rolePath = XPath.newInstance("/html/body/ul/li/ul/li");
            Element passwordObj = (Element) passwordPath.selectSingleNode(doc);
            List roleObjs = rolePath.selectNodes(doc);
            List roles = new ArrayList();

            map.put("password", passwordObj.getText());

            Iterator it = roleObjs.iterator();
View Full Code Here

            Document doc = builder.build(rep.getStream());
            Map map = new HashMap();
            XPath passwordPath = XPath.newInstance("/user/password");
            XPath rolePath = XPath.newInstance("/user/roles/role/@name");
            Element passwordObj = (Element) passwordPath.selectSingleNode(doc);
            List roleObjs = rolePath.selectNodes(doc);
            List roles = new ArrayList();

            Iterator it = roleObjs.iterator();

            while (it.hasNext()) {
View Full Code Here

   * @param xpath XPath selector.
   * @throws JDOMException
   */
  private static void analyzeRanges(Element root, List<Range> ranges, String xpath) throws JDOMException {
    XPath xpa = XPath.newInstance(xpath);
    List results = xpa.selectNodes(root);
    Iterator iter = results.iterator();
    while (iter.hasNext()) {
      Element node = (Element) iter.next();
      Element prefixNode = node.getChild("Prefix");
      String prefix = (prefixNode != null) ? prefixNode.getValue() : null;
View Full Code Here

   * @param rangeElement Range element.
   * @throws JDOMException
   */
  private static void analyzeRules(Element node, Range rangeElement) throws JDOMException {
    XPath xpa = XPath.newInstance("./Rules/Rule");
    List results = xpa.selectNodes(node);
    Iterator iter = results.iterator();
    while (iter.hasNext()) {
      Element ruleNode = (Element) iter.next();
      Element rangeNode = ruleNode.getChild("Range");
      String range = (rangeNode != null) ? rangeNode.getValue() : null;
View Full Code Here

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

      // Retrieve back links
      XPath xpa = XPath.newInstance("/api/query/pages/page");
      List listTemplates = xpa.selectNodes(root);
      Iterator itTemplate = listTemplates.iterator();
      while (itTemplate.hasNext()) {
        Element currentTemplate = (Element) itTemplate.next();
        String pageId = currentTemplate.getAttributeValue("pageid");
        String ns = currentTemplate.getAttributeValue("ns");
View Full Code Here

      // Manage redirects and missing pages
      updateRedirect(root, pages);

      // Set disambiguation status
      XPath xpa = XPath.newInstance("/api/query/pages/page");
      List results = xpa.selectNodes(root);
      Iterator iter = results.iterator();
      XPath xpaTitle = XPath.newInstance("./@title");
      XPath xpaTemplate = createXPath("templates/tl", "ns", "" + Namespace.TEMPLATE);
      List<Page> tmpPages = new ArrayList<Page>();
      while (iter.hasNext()) {
View Full Code Here

          while (it.hasNext()) {
            Page p2 = it.next();
            tmpPages.add(p2);
            if ((p2.getTitle() != null) &&
                (Page.areSameTitle(p2.getTitle(), title))) {
              List listTemplates = xpaTemplate.selectNodes(currentNode);
              if (listTemplates.size() > 0) {
                for (Page p3 : tmpPages) {
                  p3.setDisambiguationPage(Boolean.TRUE);
                }
              }
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.