Package org.dom4j

Examples of org.dom4j.Document.selectNodes()


        // E1, G1, G2, A2, A1, B2, B1, C2, C1, D2, D1, F1
        // note that the order per table is the insertion order above
        SAXReader reader       = new SAXReader();
        Document  testDoc      = reader.read(new InputSource(new StringReader(dataAsXml)));
        boolean   uppercase    = false;
        List      rows         = testDoc.selectNodes("/*/*");
        String    pkColumnName = "pk";

        assertEquals(12, rows.size());
        if (!"e".equals(((Element)rows.get(0)).getName()))
        {
View Full Code Here


                in = ((StreamSource) source).getInputStream();

                SAXReader reader = new SAXReader();
                Document document = reader.read(in);

                List<Node> lNodes = document.selectNodes("//response/result[@name='response']/doc/*");

                CatalogItem item = null;

                // loop over all matching nodes in order, so can create a new bean
                // instance on the first match and add it to the results on the last
View Full Code Here

   
    public static Object xpathList(Object object, String xpath) throws DocumentException {
        List results;
        if (object instanceof String) {
            Document doc = DocumentHelper.parseText((String) object);
            results = doc.selectNodes(xpath);
        }
       
        // Do JXPath on Bean
        else {
            if (object instanceof NativeJavaObject) {
View Full Code Here

        result = resultNode.selectNodes(xpath);
      }
      else if (firstResult instanceof String) {
        try {
          Document doc = DocumentHelper.parseText((String) firstResult);
          result = doc.selectNodes(xpath);
        }
        catch (DocumentException e) {
          addWarning("Unable to parse item content '" + itemName + "' as XML: " + firstResult);
        }
      }
View Full Code Here

      // Flags
      _allowAnonymous = Boolean.valueOf(doc.getRootElement().attributeValue("allowanonymous")).booleanValue();
     
      // Read users
      Map users = new HashMap();
      Iterator userNodes = doc.selectNodes("/users/user").iterator();
      Element userNode;
      while (userNodes.hasNext()) {
        userNode = (Element) userNodes.next();
        String name = userNode.attributeValue("name");
        String password = userNode.attributeValue("password");
View Full Code Here

      }
      _users = users;
     
      // Read Groups
      Map groups = new HashMap();
      Iterator groupNodes = doc.selectNodes("/users/group").iterator();
      Element groupNode;
      while (groupNodes.hasNext()) {
        groupNode = (Element) groupNodes.next();
        String name = groupNode.attributeValue("name");
        List members = WGUtils.deserializeCollection(groupNode.attributeValue("members"), ",", true);
View Full Code Here

  private void findInfo() throws DocumentException, ParseException {
    String source = WGet.getSource(tvrageEplistUrl + show.getTvrageId());
    Document doc = DocumentHelper.parseText(source);
   
    List<Element> nodes = doc.selectNodes("//Season[@no='"+show.getNextEpisode().getSeason()+"']/episode[seasonnum="+show.getNextEpisode().getEpisode()+"]");
    if (nodes.size() == 0) return;
    Element node = nodes.get(0);
   
    show.setNextEpisode(new Episode(show.getNextEpisode().toString(), node.elementText("title")));
   
View Full Code Here

  {
    Set<Show> shows = new HashSet<Show>();
    String source = WGet.getSource(tvRageSearch + this.name);
   
    Document doc = DocumentHelper.parseText(source);
    List<Element> nodes = doc.selectNodes("//show");
    for (Element node : nodes)
    {
      Show show = new Show(node.elementText("name"));
      show.setTvrageUrl(node.elementText("link"));
      show.setTvrageId(Util.parseInt(node.elementText("showid"), -1));
View Full Code Here

      ep.setEpisode(ep.getEpisode()+1);
      return;
    }
    Document doc = DocumentHelper.parseText(source);

    List<Element> nodes = doc.selectNodes("//episode");
    boolean next = false;
    for (Element episode : nodes) {
      if (next) {
        show.setNextEpisode(
            new Episode(
View Full Code Here

        if (doc != null) {
            Node title = doc.selectSingleNode("//head/title");

            if (title != null && title.getText() != null && title.getText().startsWith("Index of")) {
                List nodes = doc
                        .selectNodes("//pre/img[starts-with(@alt,'[') and ends-with(@alt,']')]/following::a/@href");
                List items = new ArrayList(nodes.size());

                for (Iterator i = nodes.iterator(); i.hasNext();) {
                    Node node = (Node) i.next();
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.