Document document ....//取根元素 成功
Element element = document.getDocumentElement();但是
document.getElementById("java");xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book id="java">
<author name="writer">lili</author>
</book>
</library>
Element element = document.getDocumentElement();但是
document.getElementById("java");xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book id="java">
<author name="writer">lili</author>
</book>
</library>
for (int i = 0; i < nList.getLength(); i++) {
String author= nList.item(i).getFirstChild().getNodeValue();
System.out.println(author);
}