Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing XML InputStream

Status
Not open for further replies.

Shilohcity

Technical User
Jul 12, 2000
136
GB
Hi there

I should start by saying I am fairly new to Java and am kind of bumbling my way through the following.

I have some code which makes a POST request to a website and receives an XML response back. This is working fien and I end up with an InputStream object that contains the response with HTTP Headers from the web server. This is where my problems begin. I have tried parsing the response using SAX, DOM and a PullParser I found. I can't seem to get things to work. I think the problem is the HTTP headers but I'm not sure. Now I am having a bit of a problem extracting the HTTP headers and Im not sure if Im on the right track even....

If anybody has any suggestions or useful links these would be much appreciated.

All help is gratefully received.

Cheers
Justin. X-) "Creativity is the ability to introduce order into the randomness of nature." Eric Hoffer

Visit me at
 
>> Im not sure if Im on the right track even....

Justin, you are so on the right track. It sounds like you might be handling the resquest/response using java.net.Socket? You can do that but it requires many details working with the HTTP headers etc. Instead you want to drop the use of Socket and use java.net.HttpURLConnection.

You will find many examples of using it if you google "Java HttpURLConnection"

hope that helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top