I have a url where the content is XML and it has XSL file specified. Now, when I go to that url from the browser and do view source I see the XML data BUT from the java program when I make connection and read the data via BufferedReader I get HTML (that means somewhere its making XSL applied).
I tried to set property "content-type" as "text/xml" on the URLConnection but it still gives me the HTML output.
Deleting the xsl declaration is not possible for me as I can't control xml generation
Will keep looking for ways...and of course keep JR updated..
Joined: Nov 04, 2001
I just realized that it was so stupid to set content type to be xml. I am reading data, not writing it so its wrong to set content type
At this point, I am having a question. I always thought that when we have this XSL applied to the XML , browser downloads the XML and then applies the XSL over it to display data in whatever format. Hence I thought if I make a URLConnection it would just give me the XML data as I don't have transformation applied but when I print ContentType from the URLConnection it gives me text/html which means the data is converted to html already...
Can anybody explain what exactly happens here?
subject: URLConnection returning html output instead of XML