File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Read XML from URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Read XML from URL" Watch "Read XML from URL" New topic

Read XML from URL

Subash Murugan

Joined: Mar 26, 2008
Posts: 21

I want to read an XML and parse the data from HttpUrlConnection,

from my application I will hit the URL

will return the XML string, I need to parse and get the necessary info.Which is the best way to do?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Getting an InputStream from hwere to read the URL contents can be as easy as

An example of how to use the SAX API to parse XML can be found here. Note that where it uses "" you would use the InputStream you obtained from the line of code above.
I agree. Here's the link:
subject: Read XML from URL
It's not a secret anymore!