Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

read xml file using http

Tags:

java

xml

Is anyone aware of a quick way of reading in an xml file over http? (e.g. i have a file located in http://www.abc.com/file.xml). How can i read this file from a java app

All help is greatly appreciated

Thanks Damien

like image 890
Damien Avatar asked Aug 24 '09 14:08

Damien


Video Answer


1 Answers

Use java.net.URL to get an InputStream:

final URL url = new URL("http://www.abc.com/file.xml");
final InputStream in = new BufferedInputStream(url.openStream());
// Read the input stream as usual

Exception handling and stuff omitted for brevity.

like image 66
Dave Ray Avatar answered Sep 19 '22 20:09

Dave Ray