2012-07-10 52 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

相關問題