jdom2. .
XML- Document. xml.
SAXBuilder reader = new SAXBuilder();
Document doc = null;
try
{
doc = reader.build(new File("Path to XML")); //also string is possible
}
catch (JDOMException | IOException e)
{
e.printStackTrace();
}
. . , , , childCount != 0, . , .
for (Element e : doc.getRootElement().getChildren())
{
// do something with the childs here for example
e.getText(); //would be "" in your case
for(Element child : e.getChildren()){
//do something with the child child
}
}
. attribute getName() .
DOM.