Read the XML file with JDOM, you need to create a Document object with the build () method of the org.jdom.input.saxbuilder object, and then read the desired content with the Document class, Element class, etc..
IBM: DeveloperWorks China Station has a good example: XML Version = "1.0" encoding = "UTF-8"?> 8G capacity> < Directories> 200 directories> 1580 files> 10g capacity> 500 Directories> 3000 disk> hd> The Sample.xml document above describes the basic information of the hard drive in a computer (root node represents the hard disk, the tab represents the hard disk partition, from its Name property you can see There are two partitions named "C" and "D"; each partition contains , three nodes, representing the space size, number of directories, and The number of documents) The following program reads the information in this file: import java.util. *; Import org.jdom. *; Import org.jdom.input.saxbuilder; public class sample1 {public static void main (String " ] Args) throws exception {saxbuilder sb = new saxbuilder (); document doc = sb.build ("sample.xml"); element root = doc.getrootElement (); list list = root.getchildren ("disk"); / / Take all the elements for the name for Disk (int i = 0; i