Re: Trying to capture XML data and convert to a String...
Re: Trying to capture XML data and convert to a String...
- Subject: Re: Trying to capture XML data and convert to a String...
- From: Sherm Pendley <email@hidden>
- Date: Thu, 19 Aug 2010 03:38:50 -0400
On Wed, Aug 18, 2010 at 3:11 PM, R <email@hidden> wrote:
> I'm new and in the process of learning Objective-C and Cocoa.
>
> I want to take some raw XML data, isolate, and convert to a string. I seem to be able to capture the data I want, but cannot seem to get into a string format. Actually, I will want in a NSMutableString format… but am keeping things simple for now.
>
> Here is an excerpt of my code:
>
> The problem is at the end of the code below…. the string findAlerts is empty. The NSXMLElement specificAlert prints correctly.
...
> myGames=[[gameStatusXML nodesForXPath:@"//alerts" error:&error]retain];
The alerts element in the document you pointed to is:
<alerts text="Final score in Bronx: NY Yankees 6, Detroit 2"
brief_text="At NYY: Final - NYY 6, DET 2" type="status"/>
> findAlerts=[specificAlert stringValue]; // attempting to create a string
-stringValue returns the value of any text-node children, but the
alerts node has no such children. Try using -attributes to get an
array of all the attributes, or -attributeForName: to get one of them.
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden