I apologize for the stupid question, but I am trying to use a xml file that is online in the following code.
String uri =
"http://www.myserver.com/xml?month=Jan";
URL url = new URL(uri);
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/xml");
InputStream xml1 = connection.getInputStream();
InputSource xml = new InputSource(new StringReader(xml1));
I have tried researching the answer before having to ask, but however I try to get this to work I get the error that “The constructor StringReader(InputStream) is undefined”
Thank you for any help you may provide.
Try
As the error message says, there is no constructor for
StringReaderthat takes an instance of InputStream.