00092 {
00093 super.initialize( parser );
00094
while (
mCurrentState != MessageStates.
END_MSG) {
00095
int eventType = parser.next();
00096
if (eventType == XmlPullParser.START_TAG) {
00097 String localName = parser.getName();
00098
if (localName.equals(
"symbol")) {
00099
mCurrentState = MessageStates.
SYMBOL;
00100 }
00101
else if (localName.equals(
"amount")) {
00102
mCurrentState = MessageStates.
AMOUNT;
00103 }
00104
else if (localName.equals(
"targetPrice")) {
00105
mCurrentState = MessageStates.
TARGET_PRICE;
00106 }
00107
else if (localName.equals(
"market")) {
00108
mCurrentState = MessageStates.
MARKET;
00109 }
00110
else if (localName.equals(
"processingInstructions")) {
00111
mCurrentState = MessageStates.
INSTRUCTIONS;
00112 }
00113 }
00114
else if (eventType == XmlPullParser.TEXT) {
00115
if (
mCurrentState == MessageStates.
SYMBOL ) {
00116 String text = parser.getText();
00117 text = text.trim();
00118
if (text.length() > 0) {
00119
setSymbol( text );
00120 }
00121 }
00122
else if (
mCurrentState == MessageStates.
AMOUNT ) {
00123 String text = parser.getText();
00124 text = text.trim();
00125
if (text.length() > 0) {
00126
try {
00127
int val = Integer.parseInt( text );
00128
setAmount( val );
00129 }
00130
catch (NumberFormatException e) {
00131
throw new ParseException(
"NumberFormatException for text = " + text );
00132 }
00133 }
00134 }
00135
else if (
mCurrentState == MessageStates.
TARGET_PRICE ) {
00136 String text = parser.getText();
00137 text = text.trim();
00138
if (text.length() > 0) {
00139
try {
00140
float val = Float.parseFloat( text );
00141
setTargetPrice( val );
00142 }
00143
catch (NumberFormatException e) {
00144
throw new ParseException(
"NumberFormatException for text = " + text );
00145 }
00146 }
00147 }
00148
else if (
mCurrentState == MessageStates.
MARKET ) {
00149 String text = parser.getText();
00150 text = text.trim();
00151
if (text.length() > 0) {
00152
setMarket( text );
00153 }
00154 }
00155
else if (
mCurrentState == MessageStates.
INSTRUCTIONS ) {
00156 String text = parser.getText();
00157 text = text.trim();
00158
if (text.length() > 0) {
00159
setInstructions( text );
00160 }
00161 }
00162 }
00163
else if (eventType == XmlPullParser.END_TAG) {
00164 String localName = parser.getName();
00165
if (localName.equals(
"aim_order")) {
00166
mCurrentState = MessageStates.
END_MSG;
00167 }
00168 }
00169 }
00170 }