Element element = doc.getDocumentElement(); String value = element.getValue(); System.out.println("Value: " + value);
ListIn this example, we retrieve all the child elements of the root element that have the name "name". Then, we use a foreach loop to iterate over each element and retrieve its value using getValue(). Finally, we print each value to the console. The Element class is part of the JDOM library, which provides a Java-based solution for working with XML documents.elements = root.getChildren("name"); for (Element element : elements) { String name = element.getValue(); System.out.println(name); }