1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import java.net.URL;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;

public class GetLastBuildDate {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://ja.doukaku.org/feeds/comments/");
        InputSource in = new InputSource(url.openStream());
        XPath xpath = XPathFactory.newInstance().newXPath();
        String path = "//lastBuildDate";
        Node node = (Node)xpath.evaluate(path, in, XPathConstants.NODE);
        System.out.println(node.getTextContent());
    }
}