SHARE
TWEET

TBXML - Error Handling

a guest Feb 22nd, 2012 65 Never
  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. }
RAW Paste Data
Top