wesley
wesley

Reputation: 859

how to find whether the element exists in TBXML?

In my XML,i need to find the element tag whether it exists or not using TBXML

Upvotes: -2

Views: 669

Answers (1)

Janak Nirmal
Janak Nirmal

Reputation: 22726

enter code hereYou will check if element is non nill than it exists.. as

TBXMLElement *rootElement = [xml rootXMLElement];

TBXMLElement *yourTag = [TBXML childElementNamed:@"YourTagName" parentElement:rootElement];
if(yourTag)
   NSLog(@"This element exists");
else
   NSLog(@"This element does not exist");

Upvotes: 3

Related Questions