我正在尝试调用网络服务并打印一些响应。
当我运行此代码时,我得到带有 ID、FIRSTNAME、LASTNAME、STREET、CITY 的 XML 响应。例如,我怎样才能只打印出 CITY?
static int customerId = 123456;
public static void main(String[] args) throws Exception {
URL oracle = new URL(
"http://www.thomas-bayer.com/sqlrest/CUSTOMER/" + customerId);
BufferedReader in = new BufferedReader(new InputStreamReader(
oracle.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
先感谢您。