-5
public static void printFiles(NodeList node) {
            for (int i = 0; i < node.getLength(); i++) {
                Node file = node.item(i);
                String nodeValue =  file.getAttributes().getNamedItem("urlName").getNodeValue();
                System.out.println(nodeValue);
            }
        }

output:
0a4f171c-e0a4-4aa8-b43b-3989c235ff58.txt
0ccfa1a4-16b0-4e1f-abc9-e17907bb591f.txt
17c0545b-377e-4e0a-bb45-29f38fc91533.txt
3b341bf0-2cd7-46fe-a834-5b67804e5ff1.txt
48121209-d58e-4565-83b7-05062799be6e.txt
511b7a89-e4de-4f6e-9c8f-5ba65f675d7b.txt
compress.txt
dadadada.txt
e0c44cb9-2b1c-444c-a429-64531ea6a9a0.txt
e68b1d1d-9a66-4678-a6c1-76c64ae8be08.txt
hgafgahfka.txt
jdjajhdajdajd.txt
test1.txt
test2.txt

I parsed the xml document and got the values through for loop but those alues need to be in single place like List so that I can pass to some other function.can some one please let me know how to add those in a List .Below is the code and the current Output.

Sam
  • 1
  • 1
  • 2

1 Answers1

0
String input = "hello world";    
List<String> list = new ArrayList<>();
list.add(input);
System.out.println(list.get(0));


> hello world

Good luck

Eric S.
  • 1,502
  • 13
  • 31