问题描述
我用Jsoup编写了一个Java应用程序。此应用应从html dom中读取值。当我在google或facebook之类的网站上对其进行测试时,它可以工作。 但是我想从我自己的本地网站读取实时数据(每隔第二个新数据)。 当我在网站上运行我的应用程序时,我只会得到“ null”。因为读取的是dom树,而没有实际值。
我该怎么办?希望我能帮上忙。
代码段:
Document doc = null;
try {
doc = Jsoup.connect(192.168.xx.xx).get();
System.out.println(doc.title()); //OUTPUT: Name of website
System.out.println(doc.getElementById("GuiDataOverViewPowerHouseConsumption")); //OUTPUT: NULL
} catch (IOException e) {
System.out.println("Server is not online");
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)