
String stringDelivery =
(String)attributes.get(“delivery”);
int delivery = Integer.parseInt(stringDelivery);
comparingMachine.compare(currentVendor.getText(),
price,
delivery);
}
break;
}
Lessons Learned
Listing 8.4 is typical for a SAX application. The SAX event handler pack-
ages the data in the format most appropriate for the application. It might
have to build a partial tree (in this case, using
LeafElement) in the process.
The application logic (in ComparisonMachine) is totally unaware of XML. As
far as it is concerned, the data could be coming from a database or a
comma-delimited file.
Because of this clean-cut separation between the application logic ...