2012-07-10 55 views
-2

在我XML,我需要找到该元素标签是否存在或不使用TBXML如何查找元素是否存在于TBXML中?

+0

[你有什么尝试?](http://whathaveyoutried.com/) – rckoenes 2012-07-10 07:21:19

+0

试试这个链接http://stackoverflow.com/questions/7819506/tbxml-parsing-using-objective-c – 2012-07-10 07:23:09

+0

我只是尝试与属性名称的值在哪里作为零或不......在坠毁后,我意识到我只需要特定的元素是否存在。 – wesley 2012-07-10 07:36:36

回答

3

输入代码hereYou将检查元素是非nill比它的存在。作为

TBXMLElement *rootElement = [xml rootXMLElement]; 

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

,它工作正常..感谢你 – wesley 2012-07-10 07:39:43

相关问题