I have a next XML file
<cities>
<country name="Абхазия">
<city id="37188" region="27028" head="" type="3" country="Абхазия" part="" resort="" climate="">Новый Афон</city>
</country>
</cities>
And i need to get the id attribute from the inner city node. I've done the next code, but i have no idea how to proceed:
Document doc = parser.getDomElement(xml);
NodeList nl = doc.getElementsByTagName(KEY_COUNTRY);
for (int i = 0; i < nl.getLength(); i++) {
Element e = (Element) nl.item(i);
String city = parser.getValue(e, KEY_CITY);
}
Element.getAttribute("id")? docs.oracle.com/javase/7/docs/api/org/w3c/dom/…