I have a directory in which I receive orders as XML file. I want to parse this file and then do some things with it. I can set a scheduled job to check this directory every * seconds. I want to use this to parse the file:
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new File("src/test/resources/example_jdom.xml"));
doc.getDocumentElement().normalize();
The problem is, I do not know the filename. I know the location where the XML file is going to appear, but I do not know how that file is going to be named.
How do solve this when I set my path? Since I can run my scheduled job every millisecond if I want, the chances that 2 files appear at the exact same time is negligible.