int relatedPersonCount = nodeList.getLength();
if (relatedPersonCount != 0) {
List<RelatedPerson> relatedPersonList = new ArrayList<RelatedPerson>(relatedPersonCount);
p.setHouseholdMembers(relatedPersonList);
for (int i = 0; i < relatedPersonCount; i++) {
RelatedPerson rp = new RelatedPerson();
relatedPersonList.add(rp);
Element el = (Element) nodeList.item(i);
// Set the type of relation:
rp.setRelation((RelatedPerson.Relation) unpackEnum(RelatedPerson.Relation.values(), unpackTagAttribute(el, "code", "value")));
// Set the details of the new person:
Person per = new Person();
rp.setPerson(per);
unpackPersonName(per, el, "name");
per.setSex((Person.Sex) unpackEnum(Person.Sex.values(), unpackTagAttribute(el, "administrativeGenderCode", "code")));
per.setBirthdate(unpackDate(unpackTagAttribute(el, "birthTime", "value")));
}
}