I’m trying to create a FileReader (not a Document) from an XMLResponse like this :
// Parse XML Response
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
InputSource inStream = new InputSource();
inStream.setCharacterStream(new StringReader(XMLResponse));
Document doc = db.parse(inStream);
But I don’t know how to use the InputSource to create it ?
You can’t create a
FileReader, because the response may not be coming from a file. But, as it seems, you can obtain aReader, which is the proper way to refer to readers.If a method requires specifically a
FileReader, the method is not designed properly.