You can use SAXParser to parse your all names as follows...
public class NameXMLParser extends DefaultHandler {
List<String> nameList = new ArrayList<String>();
private boolean isName = false;
private StringBuffer mBuffer = new StringBuffer();
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (localName.equalsIgnoreCase("Name")) {
isTitle = true;
}
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
if (isName) {
mBuffer.append(new String(ch, start, length));
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (localName.equalsIgnoreCase("Name")) {
nameList.add(mBuffer.toString());
isTitle = false;
mBuffer.delete(0, mBuffer.length());
}
}
public List<String> getNameList() {
return nameList;
}
}