NodeList educations = root.getElementsByTagName("education");
if (educations != null && educations.getLength() > 0) {
LOG.debug("Educations count " + educations.getLength());
educationsArr = new Education[educations.getLength()];
for (int i = 0; i < educations.getLength(); i++) {
Education educationObj = new Education();
Element educationEl = (Element) educations.item(i);
String schoolName = XMLParseUtil.getElementData(
educationEl, "school-name");
if (schoolName != null) {
educationObj.setSchoolName(schoolName);
}
String degree = XMLParseUtil.getElementData(educationEl,
"degree");
if (degree != null) {
educationObj.setDegree(degree);
}
String fieldOfStudy = XMLParseUtil.getElementData(
educationEl, "field-of-study");
if (fieldOfStudy != null) {
educationObj.setFieldOfStudy(fieldOfStudy);
}
NodeList sd = educationEl
.getElementsByTagName("start-date");
if (sd != null && sd.getLength() > 0) {
String year = XMLParseUtil.getElementData(
(Element) sd.item(0), "year");
if (year != null) {
DateComponents comp = new DateComponents();
comp.setYear(Integer.parseInt(year));
educationObj.setStartDate(comp);
}
}
NodeList ed = educationEl.getElementsByTagName("end-date");
if (ed != null && ed.getLength() > 0) {
String year = XMLParseUtil.getElementData(
(Element) ed.item(0), "year");
if (year != null) {
DateComponents comp = new DateComponents();
comp.setYear(Integer.parseInt(year));
educationObj.setEndDate(comp);
}
}
educationsArr[i] = educationObj;
}