Client-Side Presentation Logic
607
public void setCommission(int inComm) {
Commission = inComm;
}
public int getCommission() {
return Commission;
}
public void setID(int inID) {
ID = inID;
}
public int getID() {
return ID;
}
public void setDescription(String inDesc) {
Description = inDesc;
}
public String getDescription() {
return Description;
}
}
DealsParser performs its work using a SAX2-based parser. In fact, it uses the Ælfred parser in the
aelfred.jar file. com.microstar.xml.XmlHandler is the default handler implementation. The
com.microstar.xml.XmlParser is the SAX2 parser class itself.
The source of DealsParser.java can be found in the vacserv\ directory of the distribution.
import com.microstar.xml.XmlParser;
import com.microstar.xml.XmlHandler;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Vector;
import java.net.URL;
public class DealsParser extends com.microstar.xml.HandlerBase {
Note that we inherit from HandlerBase to avoid implementing all the methods of the handler
(HandlerBase provides default behavior).
private Vector myDeals;
private int maxTripNumber = 0;
private XmlParser parser;
private int curID = 0;
private int curCommission = 0;
private int curRegion = 0;
private String lastParsedText = "";
private String workString = "";
private String curPrice, curLocation, curStartdate, curDuration;
public DealsParser() {
myDeals = new Vector();
}