throw new ElasticEmailException(response);
}
}
private MailerStatus parseXmlReponse(String response) {
XMLElement xml = new XMLElement();
try {
xml.parseString(response);
// System.out.println(xml);
MailerStatus status = new MailerStatus();
@SuppressWarnings("rawtypes")
Vector children = xml.getChildren();
for ( Object c : children ) {
XMLElement x = (XMLElement) c;
if ( "status".equals(x.getName()) ) {
DeliveryStatus ds = DeliveryStatus.valueOf(x.getContent());
status.setStatus(ds);
}
else {
int val = Integer.parseInt(x.getContent());
if ( "recipients".equals(x.getName()) ) {
status.setRecipients(val);
}
else if ( "delivered".equals(x.getName()) ) {
status.setDelivered(val);
}
else if ( "failed".equals(x.getName()) ) {
status.setFailed(val);
}
else if ( "pending".equals(x.getName()) ) {
status.setPending(val);
}
else if ( "opened".equals(x.getName()) ) {
status.setOpened(val);
}
else if ( "clicked".equals(x.getName()) ) {
status.setClicked(val);
}
else if ( "unsubscribed".equals(x.getName()) ) {
status.setUnsubscribed(val);
}
else if ( "abusereports".equals(x.getName()) ) {
status.setAbusereports(val);
}
}
}