Parsing directory of multiple XML files into Java



I have successfully parsed an XML file in Java and I can read and print values.



public static void main (String args[]) {

try{
String XML = "test.xml";

DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File(XML));


I now would like to parse a directory of XML and continue to do the same ( read and print). Im thinking a simple .txt file with XML filepaths:



"test.xml"
"sample.xml"
"name.xml"

No comments:

Post a Comment