2

I want to do summation fields of web service.

I have 4 label.It show me fields of soap web service.My 3 labels it is ok but I dont know how I do collect for Total ??

Label1(AmountX)=100,Label2(AmountY)=200,Label3(AmountZ)=300,Total(AmountX+AmountY+AmountZ) = (It must be 600)

didStart

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:
(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary  
  *)attributeDict{

 if ( [elementName isEqualToString:@"AmountX"] ) {

  if (!soapResults) {

 soapResults = [[NSMutableString alloc] init];

   }

  recordResults = YES;


  }

 if ( [elementName isEqualToString:@"AmountY"] ) {

 if (!soapResults) {

  soapResults = [[NSMutableString alloc] init];


   }

   recordResults = YES;
   }
  if ( [elementName isEqualToString:@"AmountZ"] ) {

 if (!soapResults) {

  soapResults = [[NSMutableString alloc] init];


  }

   recordResults = YES;
   }




  if ( [elementName isEqualToString:@"Total"] ) {

 if (!soapResults) {

  soapResults = [[NSMutableString alloc] init];


  }

   recordResults = YES;

      }

didEnd

 - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:   
   (NSString *)namespaceURI qualifiedName:(NSString *)qName{


   if ( [elementName isEqualToString:@"AmountX"] ) {
     Label1.text = soapResults ;
     soapResults = nil; 
     recordResults = NO;

     }


    if ( [elementName isEqualToString:@"AmountY"] ) {

    Label2.text = soapResults ;

     soapResults = nil;
   recordResults = NO;

     }


     if ( [elementName isEqualToString:@"AmountZ"] ) {

    Label3.text = soapResults ;

     soapResults = nil;
   recordResults = NO;

     }




      //  For Total ???
     if ( [elementName isEqualToString:@"Total"] ) {

    Total.text = soapResults ;

     soapResults = nil;
   recordResults = NO;

     }
4

0 回答 0