我有方法:
private static void print(NodeList nodeList) {
for (int i = 0; i < nodeList.getLength(); i++) {
Node t = nodeList.item(i);
if (t.getNodeType() == Node.ELEMENT_NODE) {
System.out.println("node: " + t.getNodeName());
System.out.println("values " + t.getTextContent());
System.out.println("------------------------------");
}
if (doc.hasChildNodes()) {
print(t.getChildNodes());
}
}
}
显示xml文档的内容:
<Card>
<Thema>people</Thema>
<Type sent="true">advertising</Type>
<Country>India</Country>
<Year>1966</Year>
<Authors><Author>Julia</Author></Authors>
<Valuable>historical</Valuable>
</Card>
但未显示节点中的属性值&#34;已发送&#34;。我怎么修改它? 谢谢!