Package org.apache.abdera.xpath

Examples of org.apache.abdera.xpath.XPath.selectNodes()


        XPath xpath = getXPath();
        assertEquals(1.0d, xpath.evaluate("count(/a:feed)", feed));
        assertTrue(xpath.booleanValueOf("/a:feed/a:entry", feed));
        assertEquals(1.0d, xpath.numericValueOf("count(/a:feed)", feed));
        assertEquals("Atom-Powered Robots Run Amok", xpath.valueOf("/a:feed/a:entry/a:title", feed));
        assertEquals(1, xpath.selectNodes("/a:feed/a:entry", feed).size());
        assertTrue(xpath.selectSingleNode("/a:feed", feed) instanceof Feed);
        assertEquals(feed, xpath.selectSingleNode("..", feed.getTitleElement()));
        assertEquals(feed, xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)));
        assertEquals("The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6", xpath
            .valueOf("concat('The feed is is ',/a:feed/a:id)", feed));
View Full Code Here


   
    System.out.println(xpath.evaluate("count(/a:feed)", feed));         // 1.0
    System.out.println(xpath.numericValueOf("count(/a:feed)", feed));   // 1.0
    System.out.println(xpath.booleanValueOf("/a:feed/a:entry", feed));          // true (the feed has an entry)
    System.out.println(xpath.valueOf("/a:feed/a:entry/a:title", feed)); // Atom-Powered Robots Run Amok
    System.out.println(xpath.selectNodes("/a:feed/a:entry", feed));     // every entry
    System.out.println(xpath.selectSingleNode("/a:feed", feed));
    System.out.println(xpath.selectSingleNode("..", feed.getTitleElement()));
    System.out.println(xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)));
    System.out.println(xpath.valueOf("concat('The feed is is ',/a:feed/a:id)", feed)); // "The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
   
View Full Code Here

    XPath xpath = getXPath();
    assertEquals(xpath.evaluate("count(/a:feed)", feed), 1.0d);
    assertTrue(xpath.booleanValueOf("/a:feed/a:entry", feed));
    assertEquals(xpath.numericValueOf("count(/a:feed)", feed), 1.0d);
    assertEquals(xpath.valueOf("/a:feed/a:entry/a:title", feed), "Atom-Powered Robots Run Amok");
    assertEquals(xpath.selectNodes("/a:feed/a:entry", feed).size(), 1);
    assertTrue(xpath.selectSingleNode("/a:feed", feed) instanceof Feed);
    assertEquals(xpath.selectSingleNode("..", feed.getTitleElement()), feed);
    assertEquals(xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)), feed);
    assertEquals(xpath.valueOf("concat('The feed is is ',/a:feed/a:id)", feed), "The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6");
   
View Full Code Here

      for (QName attr : element.getAttributes())
        sw.writeAttribute(
          attr,
          element.getAttributeValue(attr));
      XPath xpath = context.getAbdera().getXPath();
      List<?> children = xpath.selectNodes("node()", element);
      for (Object child : children) {
        if (child instanceof Element) {
          process(child, new ObjectContext(child), context, conventions);
        } else if (child instanceof Comment) {
          Comment comment = (Comment) child;
View Full Code Here

  private static Object[] getChildren(
    Element element) {
      Abdera abdera = element.getFactory().getAbdera();
      XPath xpath = abdera.getXPath();
      List<Object> nodes = xpath.selectNodes("node()", element);
      return nodes.toArray(new Object[nodes.size()]);
  }
 
  private static boolean isSameNamespace(
    QName q1,
View Full Code Here

    Element root = doc.getRoot();
    root.writeTo(System.out);
    System.out.println();
   
    XPath xpath = abdera.getXPath();
    List<Element> list = xpath.selectNodes("//i",doc.getRoot());
    for (Element element : list)
      System.out.println(element);
  }
 
}
View Full Code Here

    XPath xpath = XPath.INSTANCE;
    assertEquals(xpath.evaluate("count(/a:feed)", feed), 1.0d);
    assertTrue(xpath.isTrue("/a:feed/a:entry", feed));
    assertEquals(xpath.numericValueOf("count(/a:feed)", feed), 1.0d);
    assertEquals(xpath.valueOf("/a:feed/a:entry/a:title", feed), "Atom-Powered Robots Run Amok");
    assertEquals(xpath.selectNodes("/a:feed/a:entry", feed).size(), 1);
    assertTrue(xpath.selectSingleNode("/a:feed", feed) instanceof Feed);
    assertEquals(xpath.selectSingleNode("..", feed.getTitleElement()), feed);
    assertEquals(xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)), feed);
    assertEquals(xpath.valueOf("concat('The feed is is ',/a:feed/a:id)", feed), "The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6");
   
View Full Code Here

    XPath xpath = getXPath();
    assertEquals(xpath.evaluate("count(/a:feed)", feed), 1.0d);
    assertTrue(xpath.booleanValueOf("/a:feed/a:entry", feed));
    assertEquals(xpath.numericValueOf("count(/a:feed)", feed), 1.0d);
    assertEquals(xpath.valueOf("/a:feed/a:entry/a:title", feed), "Atom-Powered Robots Run Amok");
    assertEquals(xpath.selectNodes("/a:feed/a:entry", feed).size(), 1);
    assertTrue(xpath.selectSingleNode("/a:feed", feed) instanceof Feed);
    assertEquals(xpath.selectSingleNode("..", feed.getTitleElement()), feed);
    assertEquals(xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)), feed);
    assertEquals(xpath.valueOf("concat('The feed is is ',/a:feed/a:id)", feed), "The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6");
   
View Full Code Here

   
    System.out.println(xpath.evaluate("count(/a:feed)", feed));         // 1.0
    System.out.println(xpath.numericValueOf("count(/a:feed)", feed));   // 1.0
    System.out.println(xpath.isTrue("/a:feed/a:entry", feed));          // true (the feed has an entry)
    System.out.println(xpath.valueOf("/a:feed/a:entry/a:title", feed)); // Atom-Powered Robots Run Amok
    System.out.println(xpath.selectNodes("/a:feed/a:entry", feed));     // every entry
    System.out.println(xpath.selectSingleNode("/a:feed", feed));
    System.out.println(xpath.selectSingleNode("..", feed.getTitleElement()));
    System.out.println(xpath.selectSingleNode("ancestor::*", feed.getEntries().get(0)));
    System.out.println(xpath.valueOf("concat('The feed is is ',/a:feed/a:id)", feed)); // "The feed is is urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
   
View Full Code Here

    }

    private static Object[] getChildren(Element element) {
        Abdera abdera = element.getFactory().getAbdera();
        XPath xpath = abdera.getXPath();
        List<Object> nodes = xpath.selectNodes("node()", element);
        return nodes.toArray(new Object[nodes.size()]);
    }

    private static boolean isSameNamespace(QName q1, QName q2) {
        if (q1 == null && q2 != null)
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.