In my XML
,i need to find the element tag whether it exists or not using TBXML
Asked
Active
Viewed 666 times
-2
-
[What have you tried?](http://whathaveyoutried.com/) – rckoenes Jul 10 '12 at 07:21
-
Try this link http://stackoverflow.com/questions/7819506/tbxml-parsing-using-objective-c – Sanchit Paurush Jul 10 '12 at 07:23
-
i just tried with value of attribute name where as nil or not..after getting crash,i realized that i need only the particular element is exist or not. – wesley Jul 10 '12 at 07:36
1 Answers
3
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");

Janak Nirmal
- 22,706
- 18
- 63
- 99