java - how to check if a response is in xml format instead of HTML? -



java - how to check if a response is in xml format instead of HTML? -

im working server sends me xml responds. when server lack or reports me sending me html page (it html page informing error) didn't expect , xml parser crashed. im using defaulthttpclient() , send header mhttprequest.setheader("accept", "text/xml"); proper way ensure got xml (or other specific format) response?

as kristian suggested, see if provides different content-type when html emitted. failing check <?xml... line, apposed doctype or whatever on html page.

java android xml http

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -