如有XML文件
<?xml version="1.0" encoding="UTF-8"?>
<aa>
<bb>
<cc patch="aaaaaaaaa" />
<cc patch="cccccccc" />
</bb>
<bb>
<cc patch="bbbbbbbb" />
</bb>
</aa>
//下面是部分java代码
File file = new File("test.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(file);
Element element=document.getDocumentElement();
NodeList nodeList =document.getElementsByTagName("bb");
//遍历每一个bb节点
for (int i = 0; i < nodeList.getLength(); i++) {
//这里如何获取bb节点下的所有节点
}
我试了nodeList.item(i).getChildNodes(),获取的也不是子节点啊
请问如和获取每一个bb节点下包含的cc节点