2011-01-19 4 views
-1

를받는이 작동를 사용하여 URL 내가 URL에서 XML을 읽을 수 XML

URL url = new URL("http://192.168.2.20/test.xml"); 
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
DocumentBuilder db = dbf.newDocumentBuilder(); 
Document doc = db.parse(new InputSource(url.openStream())); 
doc.getDocumentElement().normalize(); 

합니다. 그러나 인증이 필요한 URL에서 읽기를 원할 때이 방법은 실패합니다. 그래서

url = new URL("http://admin:[email protected]/test.xml"); 

이 작동하지 않습니다.

아이디어가 있으십니까?

답변

관련 문제