Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

TBXML - Error Handling

By: a guest on Feb 22nd, 2012  |  syntax: None  |  size: 0.66 KB  |  views: 58  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (void)viewDidLoad {
  2.  
  3.     TBXML * tbxml = [[TBXML tbxmlWithURL:[NSURL URLWithString:@"http://localhost/dev/mcomm/produto.xml"]] retain];
  4.     TBXMLElement * rootXMLElement = tbxml.rootXMLElement;
  5.  
  6.  
  7.  
  8. }
  9.        
  10. TBXML *tbxml = nil;
  11. @try {
  12.     tbxml = [[TBXML tbxmlWithURL:[NSURL URLWithString:@"http://localhost/dev/mcomm/produto.xml"]] retain];;
  13. }
  14. @catch (NSException *exception) {
  15.     NSLog(@"Caught %@: %@", [exception name], [exception reason]);
  16. }
  17.        
  18. TBXMLElement * xmlElement = aParentXMLElement->firstChild;
  19.        
  20. if (aParentXMLElement != nil) {
  21.     TBXMLElement * xmlElement = aParentXMLElement->firstChild;
  22. } else {
  23.     NSLog(@"Can't proceed: aParentXMLElement is nil");
  24. }