Vote count: 0
I am trying to write a service that receives a xml file and parses it and does some additional processing. At the UI controller I converted the multipart file contents to a string and passed it to the service. From the UI controller - I upload the file and call the service method to parse the xml file
MultipartFile newFile=multiPartRequest.getFile("newFileUpload");
String fileContent = new String(newFile.getBytes());
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(fileContent));
doc = dBuilder.parse(is);
However, doc is always null. What is the best way for me to rest this xml file?
asked 56 secs ago
Unable to read an uploaded multipart xml file
Aucun commentaire:
Enregistrer un commentaire