I have a lot of this:
Iterator i=el.elementIterator();
while(i.hasNext()) {
item=(Element)i.next();
name = item.getName();
if (name.equals("General")) {
addGeneralInfo(item);
} else if (name.equals("Payment")) {
//addPaymentInfo(item);
} else if (name.equals("Financial")) {
//addFinancialInfo(item);
} else if (name.equals("Beneficiary")) {
//addBeneficiary(item);
} else if (name.equals("Coverage")) {
//addCoverage(item);
} else if (name.equals("SubAccount")) {
//addAccount(item);
} else if (name.equals("ServiceRequestData")) {
// dunno...
} else if (name.equals("ErrorMessage")) {
String error=item.getTextTrim();
if(!error.equals("")) {
throw new ProcessException(100,error);
//throw new ProcessException(2102,"Policy not found.
Invalid Policy and/or Company Number");
}
}
}
Is there a better way to do this? I don't want to use Xpath all the time
(as it is expensive), but was wondering if others had come up with a better
way of doing this that does not involve the big if statement.
Jim
Jim Brain, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
"Researching tomorrow's decisions today."
(319) 369-2070 (work)
Systems Architect, ITS, AEGON Financial Partners
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user