如果是用的是jdom
Reader in = new StringReader("你的xml路径");
Document doc = builder.build(in);
Element root = doc.getRootElement();//获取root
List list=root.getChildren();
for(int i=0;i<list.size();i++){
Element childNode=(Element)list.get(i);
        //获取属性用getAttributeValue
String type=childNode.getAttributeValue("type");
}