我有以下方式的XML文件:解析在JDOM的孩子,孩子一个XML文件中的节点
<head>
<username>bhnsub</username>
<error>0</error>
<account_id>633</account_id>
<info>
<mac>address_goes_here<mac>
<mac>address_goes_here</mac>
<mac>address_goes_here</mac>
<mac>address_goes_here</mac>
<mac>address_goes_here<mac>
</info>
</head>
我需要使用Java DOM解析器解析,并得到相应的值。 我需要把值列表中的信息。
SAXBuilder builder = new SAXBuilder();
Document document = (Document) builder.build(new StringReader(content));
Element rootNode = document.getRootElement();
if (rootNode.getName().equals("head")) {
String username = rootNode.getChildText("username");
String error= rootNode.getChildText("error");
String account= rootNode.getChildText("account_id");
Element info= rootNode.getChildren("info");
List mac=info.getChildren("mac");
我没有得到如何进一步处理和使用列表。