在 java 中,我正在尝试阅读网页。我只想打印页面的数据。但是我的代码正在打印整个 html 代码。看起来很奇怪。我可以看到我想要的确切数据隐藏在 html 中。我怎样才能摆脱打印html代码? 这是我的代码:
URL url = new URL("http://www.rxbd.info/Controller/Controller?action=details&drug=zorubicin&group=generic");
URLConnection con = url.openConnection();
InputStream is =con.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null ) {
System.out.println(line);
}
最佳答案
关于java - 如何从网页打印数据?不是页面的html代码。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20687184/