我使用此代碼來下載Xml文件。
String url="https://www.sec.gov/Archives/edgar/data/16160/000001616016000061/calm-20160528.xml";
String fileName = url.substring(url.lastIndexOf("/") + 1,
url.length());
String completeFileLocationWithName="/home/user/Downloads/XBRLCODE/"+fileName;
URL surl = new URL(url);
con = surl.openConnection();
con.setConnectTimeout(0);
con.setReadTimeout(0);
InputStream in = con.getInputStream();
Files.copy(in, Paths.get(completeFileLocationWithName));*/
,並試圖與String escapedInput = StringEscapeUtils.escapeXml(appNameInput);
輸入:URL
輸出是在下載XML,它不應該有像上面這樣<
,>
,&
等人物 - 而不是<,>,&對我來說會很好..
請任何人分享這個知識..
你是否還要檢查unescapeHtml方法StringEscapeUtils – HRgiger
字符串escapedInput = StringEscapeUtils.unescapeHtml4(格); –
@HRgiger試過..plz分享代碼 –