Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In my app i'm using TBXML parser where i need to get a value from xml file and print it on the label...This is my xml file in server

 <gold>
 <price>
 <title>22 K Gold</title>
  </price>
  <price>
  <title>24 K Gold</title>
 </price>
   </gold>

any my Viewcontroller.h looks like

#import <UIKit/UIKit.h>
#import "TBXML.h"

 @interface ViewController : UIViewController{

 IBOutlet UILabel *lab;
 IBOutlet UILabel *lab1;
TBXML *tbxml;
  }



  @end

and my Viewcontrooler.m looks like

  - (void)viewDidLoad
  {
   [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
   NSData *xmlData = [[NSData alloc]initWithContentsOfURL:[NSURL  URLWithString:@"http://www.abcde.com/sample.xml"]];
 tbxml = [[TBXML alloc]initWithXMLData:xmlData];


  TBXMLElement * root = tbxml.rootXMLElement;

  if (root)
 {
TBXMLElement * elem_PLANT = [TBXML childElementNamed:@"price" parentElement:root];
while (elem_PLANT !=nil)
{
    TBXMLElement * elem_BOTANICAL = [TBXML childElementNamed:@"title" parentElement:elem_PLANT];
    NSString *botanicalName = [TBXML textForElement:elem_BOTANICAL];
    lab.text=[NSString stringWithFormat:@"re %@", botanicalName];

    elem_PLANT = [TBXML nextSiblingNamed:@"price" searchFromElement:elem_PLANT]; 

    elem_BOTANICAL = [TBXML childElementNamed:@"title" parentElement:elem_PLANT]; 

    botanicalName = [TBXML textForElement:elem_BOTANICAL];
    lab1.text=[NSString stringWithFormat:@"re %@", botanicalName];
}
 }

 }

i'm getting BAD_ACCESS thread.Am i missing anything...Help pls...

share|improve this question
Please have a look to see if this was answered on our programming site, stackoverflow.com – bmike Jul 5 '12 at 14:25

closed as off topic by Mark, bmike Jul 5 '12 at 14:25

Questions on Ask Different are expected to relate to Apple hardware or software within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.