Package us.monoid.web

Examples of us.monoid.web.Resty.xml()


public class RestyXmlTest {

  @Test
  public void testXml() throws Exception {
    Resty r = new Resty();
    NodeList nl = r.xml("http://rss.slashdot.org/Slashdot/slashdotGamesatom").get("feed/entry/link");
    assertNotNull(nl);
    for (int i = 0, len = nl.getLength(); i < len; i++) {
      System.out.println(((Element)nl.item(i)).getAttribute("href"));
    }
  }
View Full Code Here


  }
 
  @Test
  public void testXml2Text() throws Exception {
    Resty r = new Resty();
    String text = r.xml("http://rss.slashdot.org/Slashdot/slashdotDevelopersatom").toString();
    System.out.println(text);
    assertTrue(text.contains("Slashdot: Developers"));
  }
 
  /** Getting the Google Developer calendar feed as JSON and following to the first entry, which is an XML resource:
View Full Code Here

public class RestyXmlTest {

  @Test
  public void testXml() throws Exception {
    Resty r = new Resty();
    NodeList nl = r.xml("http://rss.slashdot.org/Slashdot/slashdotGamesatom").get("feed/entry/link");
    assertNotNull(nl);
    for (int i = 0, len = nl.getLength(); i < len; i++) {
      System.out.println(((Element)nl.item(i)).getAttribute("href"));
    }
  }
View Full Code Here

  }
 
  @Test
  public void testXml2Text() throws Exception {
    Resty r = new Resty();
    String text = r.xml("http://rss.slashdot.org/Slashdot/slashdotDevelopersatom").toString();
    System.out.println(text);
    assertTrue(text.contains("Slashdot: Developers"));
  }
 
  /** Getting the Google Developer calendar feed as JSON and following to the first entry, which is an XML resource:
View Full Code Here

   * @throws Exception
   * @throws 
   */
  public static void main(String[] args) throws Exception {
    Resty r = new Resty();
    String result = r.xml("http://bart.gov/dev/eta/bart_eta.xml").get("/root/station/eta/estimate[../../name/text()='Powell St.' and ../destination/text()='SF Airport']", String.class);
    System.out.println("Next train to SFO from Powell St.:" + result);
  }

}
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.