I have method:
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());
}
}
}
It displays the contents of the xml document:
<Card>
<Thema>people</Thema>
<Type sent="true">advertising</Type>
<Country>India</Country>
<Year>1966</Year>
<Authors><Author>Julia</Author></Authors>
<Valuable>historical</Valuable>
</Card>
but does not show the value of the attribute in the node "sent". How can I modify it? Thanks!