I am reading an XML file from server and then parsing it to save as csv file. I am getting an error mentioned in the subject. Any idea how i can overcome this??
this is my code:
private void CreateXML2CSV(String inputStream) {
try {
File stylesheet = new File("src/main/resources/adv_cat.xsl");
File xmlSource = new File(inputStream); // Error occurs here !!!. Inputstream is my xml string
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlSource);
StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(stylesource);
Source source = new DOMSource(document);
Result outputTarget = new StreamResult(new File("src/main/resources/adv_cat.csv"));
transformer.transform(source, outputTarget);
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
System.out.println("writeToFile Success!");
}
This is the error message:
java.io.FileNotFoundException:
C:\Users\Lincube\workspace\Liverail\<?xml version="1.0" encoding="UTF-8"?><liverailapi requested=".....<\executiontime><\liverailapi> (<\executiontime><\liverailapi>(The filename or extension is too long))
No comments:
Post a Comment