Class BestDeal
- java.lang.Object
-
- BestDeal
-
public class BestDeal extends java.lang.Object
Rewritten http://www-106.ibm.com/developerworks/xml/library/x-saxapi/listing4.html to make easy to comapre how to "natutal is to manage state with SAX and with XMLPULL API. For details see: http://www-106.ibm.com/developerworks/xml/library/x-saxapi/
-
-
Field Summary
Fields Modifier and Type Field Description int
delivery
protected static java.lang.String
MESSAGE
protected static java.lang.String
NAMESPACE_URI
double
price
properties we are collecting: best price, delivery time, product and vendor namesjava.lang.String
product
protected int
targetDelivery
target delivery value (refuse elements above this target)java.lang.String
vendor
-
Constructor Summary
Constructors Constructor Description BestDeal(int td)
creates an "empty" BestDeal with the given target for delivery
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkVendor(XmlPullParser parser)
subroutine handling a single vendorstatic void
main(java.lang.String[] args)
main() method decodes command-line parameters and invoke the parservoid
update(XmlPullParser parser)
updates the best deal from the given list in the format
-
-
-
Field Detail
-
MESSAGE
protected static final java.lang.String MESSAGE
- See Also:
- Constant Field Values
-
NAMESPACE_URI
protected static final java.lang.String NAMESPACE_URI
- See Also:
- Constant Field Values
-
price
public double price
properties we are collecting: best price, delivery time, product and vendor names
-
delivery
public int delivery
-
product
public java.lang.String product
-
vendor
public java.lang.String vendor
-
targetDelivery
protected int targetDelivery
target delivery value (refuse elements above this target)
-
-
Method Detail
-
update
public void update(XmlPullParser parser) throws java.io.IOException, XmlPullParserException
updates the best deal from the given list in the format- Throws:
java.io.IOException
XmlPullParserException
-
checkVendor
public void checkVendor(XmlPullParser parser) throws java.io.IOException, XmlPullParserException
subroutine handling a single vendor- Throws:
java.io.IOException
XmlPullParserException
-
main
public static void main(java.lang.String[] args) throws java.io.IOException, XmlPullParserException
main() method decodes command-line parameters and invoke the parser- Parameters:
args
- command-line argument- Throws:
java.io.IOException
XmlPullParserException
-
-