Parsing XML but got errors

So I am attempting to Parse a RSS feed using TFHpple parser. Here is the code in question:
// AriesView.m
// Horoscopes
// Created by DJB on 9/2/10.
// Copyright 2010 _MyCompanyName_. All rights reserved.
#import "AriesView.h"
@implementation AriesView
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *data = [NSString stringWithContentsOfURL:[NSURL URLWithString: @"feed://www.findyourfate.com/rss/dailyhoroscope-feed.asp?sign=Aries"] encoding:NSUTF8StringEncoding error:NULL];
NSData *htmlData = [data dataUsingEncoding:NSUTF8StringEncoding];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
NSArray *elements = [xpathParser search:@"/item/description"];
NSLog( @"%@", elements);
TFHppleElement *element = [elements objectAtIndex:0];
NSString *paragraph = [element content];
NSLog(@"%@", paragraph);
summary.text = paragraph;
[xpathParser release];
[htmlData release];
When I run the program and click on the button that bring me to this view, the app crashes. When looking at the Debug log, this is what it says:
[Session started at 2010-09-04 14:16:32 -0400.]
2010-09-04 14:16:38.758 Horoscopes[19390:207] Unable to parse.
2010-09-04 14:16:38.760 Horoscopes[19390:207] (
2010-09-04 14:16:38.762 Horoscopes[19390:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
* Call stack at first throw:
0 CoreFoundation 0x024bf919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0260d5de objcexceptionthrow + 47
2 CoreFoundation 0x024b5465 -[__NSArrayM objectAtIndex:] + 261
3 Horoscopes 0x000029ba -[AriesView viewDidLoad] + 333
4 UIKit 0x0048bc26 -[UIViewController view] + 179
5 UIKit 0x0048d43f -[UIViewController viewControllerForRotation] + 36
6 UIKit 0x00489682 -[UIViewController _visibleView] + 90
7 UIKit 0x0074affd -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 269
8 UIKit 0x0040a0a0 -[UIWindow _setRotatableClient:toOrientation:duration:force:] + 921
9 UIKit 0x00677543 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 768
10 UIKit 0x0048f769 -[UIViewController presentModalViewController:withTransition:] + 2937
11 Horoscopes 0x00002219 -[HoroscopesViewController next:] + 139
12 UIKit 0x003e3e14 -[UIApplication sendAction:to:from:forEvent:] + 119
13 UIKit 0x0046d6c8 -[UIControl sendAction:to:forEvent:] + 67
14 UIKit 0x0046fb4a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
15 UIKit 0x0046e6f7 -[UIControl touchesEnded:withEvent:] + 458
16 UIKit 0x004072ff -[UIWindow _sendTouchesForEvent:] + 567
17 UIKit 0x003e91ec -[UIApplication sendEvent:] + 447
18 UIKit 0x003edac4 _UIApplicationHandleEvent + 7495
19 GraphicsServices 0x02c01afa PurpleEventCallback + 1578
20 CoreFoundation 0x024a0dc4 _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION_ + 52
21 CoreFoundation 0x02401737 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x023fe9c3 __CFRunLoopRun + 979
23 CoreFoundation 0x023fe280 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x023fe1a1 CFRunLoopRunInMode + 97
25 GraphicsServices 0x02c002c8 GSEventRunModal + 217
26 GraphicsServices 0x02c0038d GSEventRun + 115
27 UIKit 0x003f1b58 UIApplicationMain + 1160
28 Horoscopes 0x00001f44 main + 102
29 Horoscopes 0x00001ed5 start + 53
terminate called after throwing an instance of 'NSException'
What am I doing wrong? How can I fix the problem?

I changed my code around and got the information that I wanted parsed. Now, however, when I run the app, and click on a button that I made to reload the data, the app crashes. I have also placed two NSLogs that show that they both receive the data that I want. My problem now, is that even though paragraph has the correct data in it, it won't output the data into the UILabel *summary. Any ideas?
-(IBAction)reloadInfo:(id)sender {
if (sender == reload) {
NSString *data = [NSString stringWithContentsOfURL:[NSURL URLWithString: @"http://www.astrology-enterprises.com/show_HOROSCOPES.asp?SIGN=ARIES&VIEW=0"] encoding:NSUTF8StringEncoding error:NULL];
NSData *htmlData = [data dataUsingEncoding:NSUTF8StringEncoding];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
NSArray *elements = [xpathParser search:@"//html//body//span"];
NSLog(@"%@", elements);
TFHppleElement *element = [elements objectAtIndex:0];
NSString *paragraph = [element content];
NSLog(@"%@", paragraph);
summary.text = paragraph;
[xpathParser release];
[htmlData release];

Similar Messages

  • My install of maverick failed as disk is damaged and cannot repaired. I tried to erase disk but got error that disk cannot be umounted. Please help! Thank you very much.

    My install of maverick failed as disk is damaged and cannot repaired. I tried to erase disk but got error disk cannot be unmounted. Please help. What can i do? Thank you very much.

    First have you got a backup of your data? If not try to get one now while you have some access to the drive. The drive is probably faulty and will need to be replaced, without the backup you risk losing the data.
    Have you a bootable external USB drive with Mavericks on it, if so boot from that and try and repair or erase the drive and reinstall Mavericks.
    If you don't have Mavericks on an external drive,  boot from you Leopard DVD ( I am presumimg your profile is correct) and run Disk Utility from there, you may be able to erase the drive and reload Leopard. You can then install Mavericks. Even if all that works you will most likely need a new drive in the near future.

  • Tried to restore and update but got error code after download, iphone 4 on verizon...ios 4.2.1 tried to restore and update but got error code after download

    iphone 4 on verizon(16 gb) ios 4.2.1 tried to restore and update but got error code after download.... all the iphone does is sit there with the picture to connect to itunes. This is very important, please help!!!!!! updated itunes and restarted and have tried everything... this iphone has never been synced or backed up with itunes. please help!

    error 1015 usually means you have a jailbroken  devices, which per the term of use of the forum, you can't get any help here.

  • How do you burn videos taken with myIphone and stored on my computer to a DVD disc.  I purchased and tried using RealPlayer Plus 16 but got error message saying "unsopported media type"?  I alos tried using Real Players file converter with no success!

    How do you burn videos taken with my Iphone 4S and stored on my computer to a DVD disc.  I purchased and tried using RealPlayer Plus 16 but got error message saying "unsopported media type"?  I also tried using Real Players file converter with no success!  Thanks in advance for any help you can give!

    Probably the OP is no longer paying attention to this unless the OP is subscribed to this discussion.  While not really an iPhone question I guess using an iPhone to produce the movie which then needs taking to the next step makes this as good a starting place as any unless you happen to know enough about what to do to determine in which forum to post.  A suggestion in that direction would help.
    Anyway, Apple is backing off from supporting optical media.  It also depends upon what you mean by "DVD".  A DVD is just an optical disc which can support different file formats, but many people think it means a movie disc you can put in your TV.  Producing a movie disc requires special iDVD authoring software Apple used to sell but stopped several years ago.  I don't know if the old versions work under newer systems.  There's also the free Burn application which authors DVDs but takes a bit of learning and has nowhere near the features of iDVD.
    If the OP means simply burning the transferred movie files to a DVD for archiving in computer format you don't need special software for that; its built into the operating system File > New Burn folder etc.

  • I tried downloading the Adobe Premiere and Photoshop 13, but got error 7. Would someone help me with this?

    I have a PC and tried downloading Photoshop and premiere but weren't able to complete. I got error 7. Does this mean not compatible with my PC? It has windows 7.

    uninstall, clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) and reinstall.
    if you see an error message in english, attach a screenshot of it.

  • Tried to load wordpress but got error message that it was not running php, can it, and if so, how

    Tried to download "WordPress" thru Firefox, but got an error message that my Firefox was not running php. Can Firefox run php, and if so, what do I do to make it happen?

    its loading fine on my system and i don't have any special Add-on or Plugin installed specifically for it :-P
    However see this post:
    https://support.mozilla.com/en-US/questions/782622
    Check and tell if its working.

  • Just updated my iphone 3gs but got error 3194?

    hi
    i have just gone to update my iphone 3gs and got error code 3194 and now it seems as if it stuck in recovery mode

    The ONLY reason that gs.apple.com would be in your hosts file is if the computer was ever used to hack, jailbreak or otherwise mod ANY iPhone (not just the one you are having a problem with now).
    The specific description of this error is:
    Error 3194: Resolve error 3194 by updating to the latest version of iTunes.   "This device is not eligible for the requested build" in the updater logs confirms this is the root of the issue.
    You can also get this error if you have ever installed a version of iOS that was obtained other than through iTunes.

  • I lost flash player so tried to reinstall but got error messge the IE has to close?

    I lost flash player so tried to install again but got message that IE had to close.  No other windows were open??

    Hello,
    Welcome to Adobe Forums.
    Sometimes application are still running on background, not visible to users, you need to close them using "Windows Task Manager"
    To close such programs use the Windows Task Manager.  To start Task Manager, take any of the following actions:
    Press CTRL+ALT+DELETE, and then click Task Manager.
    Press CTRL+SHIFT+ESC.
    Right-click an empty area of the taskbar, and then click Task Manager.
    Once the Task Manager is running, select the Processes tab.  On older Windows version you may need to click on the Process Name or Image Name header to sort the process names.
    Now right-click on every process that the Flash Player installer needs to close (e.g. iexplore.exe), then select End Process.
    Thanks,
    Vikram

  • JDOM: Parsing XML String, getting error

    Hello,
    I am new to this forum, so please forgive me
    if this has already been asked before. I want to
    parse an XML string. I know the JDOM parser works
    great with a file, but apparently I have been
    unsuccessful parsing an XML String. Below is how I
    initialize the parser:
    import java.io.*; //Import proper packages
    import org.jdom.*;
    import org.jdom.input.*;
    import org.jdom.output.*;
    import java.util.*;
    import java.lang.*;
    public class XMLParser{
    private Document doc = null;
    public XMLParser(String xml){
    doc = readDocument(xml);
    private Document readDocument(String xml) {
    try {
    SAXBuilder builder = new SAXBuilder();
    org.jdom.Document result = builder.build(new
    StringReader(xml));
    return result;
    } catch(JDOMException e) {
    e.printStackTrace();
    } catch(NullPointerException e) {
    e.printStackTrace();
    return null;
    } //readDocument
    The following is the error I receive:
    JDOM/xmlparser.java [81:1] cannot resolve symbol
    symbol : method build (java.io.StringReader)
    location: class org.jdom.input.SAXBuilder
    org.jdom.Document result = builder.build(new
    StringReader(filename));
    --> Arrow pointing to builder.build
    Please if someone can help me out. If JDOM does not
    have this feature, then can someone please recommend a
    parser that can parse an XML String.

    Thank you for your help, although it seems like it was JDom 9 beta. When I tried with JDOM 8 beta, everything worked fine even with the StringReader. So if anyone is having similar problems with JDom 9 then try with JDom 8.

  • Tried to install a new game but got error message "You can't open the application "XIII Install" because PowerPC applications are no longer supported."  I have since read that Yosemite doesn't have the program. What can I do?

    Tried to install a new game that I bought (Xiii) for my MBP. All system req have been met and exceeded, however when trying to install it I get an error message saying "You can’t open the application “XIII Install” because PowerPC applications are no longer supported."
    I have since read online that the operating software Yosemite has got rid of PowerPC applications, meaning I can't install my new game. 
    Is there anything simple that I can do to get this game to work. I'll be gutted if not as I have opened the game therefore the shop will not give a full refund, I'm sure .
    Regards
    Simon

    A lot longer ago than that. PowerPC apps haven't been supported since Lion, 10.7.x.
    You may have just purchased the game, but the developers obviously haven't kept up to date with the requirements for newer versions of the Mac OS.
    You have three options, depending on how old your Mac is.
    1) If it were ever able to boot directly to Snow Leopard, you could create a separate partition and install SL onto that partition. Make sure to turn on the option during the installation to install Rosetta. That is OS X's PPC emulator.
    2) If your Mac is too new to install Snow Leopard, then you can purchase and install Snow Leopard Server within a VM, such as Parallels, VirtualBox, or Vmware.
    3) Use a separate older Mac for running outdated software.

  • Mac mini Erase hd and reinstall os x lion, but got error -2200F

    i have lots of files and unwanted apps in my mac mini, there for i decided to erase hd and reinstall mac os x lion.
    (then i wanted to upgrade to mavericks)
    so i followed the user manual and enter to disk utility by presseng "commend" & "R" while restarting.
    and then Erase hd an clicked "reinstall mac os x lion" on disk utility.
    but while downloading os for instalation i have to cancle and shutdown mac mini because of thundering.
    in very next day i try to do the same by entering to disk utility by pressing command+R.
    then screen appears with "internet recovery...." like bellow
    but then appeard error "-2200F" (but my internet connection work well)
    but i tried this few times and then how ever i got through this and enter to disk utility again.
    then i start reinstalling mac os x lion and it was going well and progress bar was filling well.
    but suddenly it stoped and return to disk utility front again. i tried few times but still facing same problem.
    im from Sri Lanka. please any one can help me solve this.
    Thanks.

    Do you have another Mac? If so try downloading the Lion installer and make a bootable install media.
    http://liondiskmaker.com/

  • Proc a simple program but got error

    I tried to proc the sample program cppdemo1.pc with the
    following command....
    proc CODE=CPP include=/usr/include/
    include=/opt/SUNWspro/WS6U2/include/CC/Cstd/
    include=/opt/SUNWspro/WS6U2/include/CC/ cppdemo1.pc
    but I got
    INTERNAL ERROR: Failed assertion [PGE Code=90105]
    Segmentation Fault
    WHY???

    A lot longer ago than that. PowerPC apps haven't been supported since Lion, 10.7.x.
    You may have just purchased the game, but the developers obviously haven't kept up to date with the requirements for newer versions of the Mac OS.
    You have three options, depending on how old your Mac is.
    1) If it were ever able to boot directly to Snow Leopard, you could create a separate partition and install SL onto that partition. Make sure to turn on the option during the installation to install Rosetta. That is OS X's PPC emulator.
    2) If your Mac is too new to install Snow Leopard, then you can purchase and install Snow Leopard Server within a VM, such as Parallels, VirtualBox, or Vmware.
    3) Use a separate older Mac for running outdated software.

  • Can I open Raw files from Olympus OM-D EM-1 camera in CS6? I tried running up dates but got error message 44M11200.

    Thought this Olympus camera was covered by CS6 but can't seem to install updates to solve probs.  Error message appears  44M11200

    The T1i was first supported by Camera Raw 5.4 which is only compatible with CS4 and later
    Camera Raw plug-in | Supported cameras
    Camera Raw-compatible Adobe applications
    Some options:
    Upgrade to CS6
    Join the Cloud
    Download the free Adobe DNG converter, convert all T1i Raw files to DNGs then edit the DNGs in CS3
    Camera raw, DNG | Adobe Photoshop CC

  • Creative suite CS3 lost Licensing and stopped working. support sent me to a site to download CS3 application but got error 404. How do I download?

    Adobe support sent me to a  Photoshop suite CS3 site but when I clicked the download for mac option I was redirected to a site with an error 404.

    Download CS3 products
    For anything beyond that you will have to be a lot more specific and provide proper system information or details like what browser you use.
    Mylenium

  • TS3694 Trying to upgrade to OS 6 but got error message 3014 ???

    When trying to install the software upgrade to OS 6 I got an error message 3014 ???

    check this article, you can probably find the answer here: http://support.apple.com/kb/TS3694

Maybe you are looking for

  • Labview won't believe that my frame grabber board is configured?

    Thank you in advance for any help I am new to labview. I am sorry if this is a silly question, but I have worked on it for hours and haven't been able to find the solution. I am using a NI-IMAQ PCI-1422 board to aquire images from a Pulnix TM 1020 ca

  • T61p squeaky noise

    model 6457-7XG I hear squeaky noise when working on graphic intense programs ... like a autocad (some operations) ... or quest 3D(all the time) plus also I had issues with graphic to stop working .... like you mentioned ... MIGR-72482 but I am workin

  • How can I import a "book" from Aperture into iPhoto?

    I've created a "Book" in Aperture and want to import it into iPhoto so I can send the book to EU for the US. Thank you in advance!

  • Need help sequencing Yamaha s80 in GarageBand

    I'm new to Mac and new to trying to hook up my Yamaha s80 to do sequencing. I have GB 09 and an M-Audio Uno midi interface. I'm compfused. I'm not sure where to begin, don't know whether i need special drivers or what settings to adjust. I realize th

  • RMI Connection

    Hi there, I am wondering is there anyway to make a RMI connection in such a manor as to allow the remote methods to be called from anywhere in the application, without re initializing the original connection. For example say I have a client with the