Im writing an iPhone app which retrieves data from a web service as XML. If no data is found by the web service, it returns an empty document like
<?xml version="1.0"?>
<root_element/>
This data is being parsed and then added to an array and subsequently a table view.
In my -numberOfRowsInSection
I have return [self.array count];
But obviously if the document is empty, nothing is added to the array, and i dont get a parse error, but instead get an index out of bounds
error. Is there a isDocumentEmpty
method or some such means of checking to see if the document has elements?
How else would you suggest i check this? And what way should i use to alert the user? An alert view and then pop the controller?
Thanks.