Class BestDeal
java.lang.Object
BestDeal
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 -
Constructor Summary
ConstructorsConstructorDescriptionBestDeal
(int td) creates an "empty" BestDeal with the given target for delivery -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkVendor
(XmlPullParser parser) subroutine handling a single vendorstatic void
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 Details
-
MESSAGE
- See Also:
-
NAMESPACE_URI
- See Also:
-
price
public double priceproperties we are collecting: best price, delivery time, product and vendor names -
delivery
public int delivery -
product
-
vendor
-
targetDelivery
protected int targetDeliverytarget delivery value (refuse elements above this target)
-
-
Constructor Details
-
BestDeal
public BestDeal(int td) creates an "empty" BestDeal with the given target for delivery- Parameters:
td
- the target for delivery
-
-
Method Details
-
update
updates the best deal from the given list in the format- Throws:
IOException
XmlPullParserException
-
checkVendor
subroutine handling a single vendor- Throws:
IOException
XmlPullParserException
-
main
main() method decodes command-line parameters and invoke the parser- Parameters:
args
- command-line argument- Throws:
IOException
XmlPullParserException
-