2

Web サービスの集計フィールドを実行したい。

4 つのラベルがあります。SOAP Web サービスのフィールドが表示されます。3 つのラベルは問題ありませんが、合計を収集する方法がわかりません。

Label1(AmountX)=100,Label2(AmountY)=200,Label3(AmountZ)=300,Total(AmountX+AmountY+AmountZ) = (必ず600)

開始しました

-(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;

      }

終了しました

 - (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